
Move gd symbols into php_gd namespace to prevent symbol conflicts.

--- php-4.3.8/ext/gd/libgd/gd.h.gdnspace
+++ php-4.3.8/ext/gd/libgd/gd.h
@@ -5,6 +5,8 @@
 extern "C" {
 #endif
 
+#include "php_compat.h"
+
 #ifndef WIN32
 /* default fontpath for unix systems */
 #define DEFAULT_FONTPATH "/usr/X11R6/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/truetype:/usr/X11R6/lib/X11/fonts/TTF:/usr/share/fonts/TrueType:/usr/share/fonts/truetype:/usr/openwin/lib/X11/fonts/TrueType:/usr/X11R6/lib/X11/fonts/Type1:."
--- php-4.3.8/ext/gd/libgd/gdtables.c.gdnspace
+++ php-4.3.8/ext/gd/libgd/gdtables.c
@@ -1,4 +1,6 @@
 
+#include "php_compat.h"
+
 int gdCosT[] =
 {
   1024,
--- php-4.3.8/ext/gd/libgd/wbmp.h.gdnspace
+++ php-4.3.8/ext/gd/libgd/wbmp.h
@@ -12,6 +12,7 @@
 #ifndef __WBMP_H
 #define __WBMP_H	1
 
+#include "php_compat.h"
 
 /* WBMP struct
 ** -----------
--- php-4.3.8/main/php_compat.h.gdnspace
+++ php-4.3.8/main/php_compat.h
@@ -107,6 +107,189 @@
 #define XML_ParserReset php_XML_ParserReset
 #endif
 
+#ifdef HAVE_GD_BUNDLED
+#define any2eucjp php_gd_any2eucjp
+#define createwbmp php_gd_createwbmp
+#define empty_output_buffer php_gd_empty_output_buffer
+#define fill_input_buffer php_gd_fill_input_buffer
+#define freewbmp php_gd_freewbmp
+#define gdAlphaBlend php_gd_gdAlphaBlend
+#define gdCompareInt php_gd_gdCompareInt
+#define gdCosT php_gd_gdCosT
+#define gdDPExtractData php_gd_gdDPExtractData
+#define gdFontGetGiant php_gd_gdFontGetGiant
+#define gdFontGetLarge php_gd_gdFontGetLarge
+#define gdFontGetMediumBold php_gd_gdFontGetMediumBold
+#define gdFontGetSmall php_gd_gdFontGetSmall
+#define gdFontGetTiny php_gd_gdFontGetTiny
+#define gdFontGiant php_gd_gdFontGiant
+#define gdFontGiantData php_gd_gdFontGiantData
+#define gdFontGiantRep php_gd_gdFontGiantRep
+#define gdFontLarge php_gd_gdFontLarge
+#define gdFontLargeData php_gd_gdFontLargeData
+#define gdFontLargeRep php_gd_gdFontLargeRep
+#define gdFontMediumBold php_gd_gdFontMediumBold
+#define gdFontMediumBoldData php_gd_gdFontMediumBoldData
+#define gdFontMediumBoldRep php_gd_gdFontMediumBoldRep
+#define gdFontSmall php_gd_gdFontSmall
+#define gdFontSmallData php_gd_gdFontSmallData
+#define gdFontSmallRep php_gd_gdFontSmallRep
+#define gdFontTiny php_gd_gdFontTiny
+#define gdFontTinyData php_gd_gdFontTinyData
+#define gdFontTinyRep php_gd_gdFontTinyRep
+#define gdGetBuf php_gd_gdGetBuf
+#define gdGetByte php_gd_gdGetByte
+#define gdGetC php_gd_gdGetC
+#define _gdGetColors php_gd__gdGetColors
+#define gd_getin php_gd_gd_getin
+#define gdGetInt php_gd_gdGetInt
+#define gdGetWord php_gd_gdGetWord
+#define gdImageAABlend php_gd_gdImageAABlend
+#define gdImageAALine php_gd_gdImageAALine
+#define gdImageAlphaBlending php_gd_gdImageAlphaBlending
+#define gdImageAntialias php_gd_gdImageAntialias
+#define gdImageArc php_gd_gdImageArc
+#define gdImageChar php_gd_gdImageChar
+#define gdImageCharUp php_gd_gdImageCharUp
+#define gdImageColorAllocate php_gd_gdImageColorAllocate
+#define gdImageColorAllocateAlpha php_gd_gdImageColorAllocateAlpha
+#define gdImageColorClosest php_gd_gdImageColorClosest
+#define gdImageColorClosestAlpha php_gd_gdImageColorClosestAlpha
+#define gdImageColorClosestHWB php_gd_gdImageColorClosestHWB
+#define gdImageColorDeallocate php_gd_gdImageColorDeallocate
+#define gdImageColorExact php_gd_gdImageColorExact
+#define gdImageColorExactAlpha php_gd_gdImageColorExactAlpha
+#define gdImageColorMatch php_gd_gdImageColorMatch
+#define gdImageColorResolve php_gd_gdImageColorResolve
+#define gdImageColorResolveAlpha php_gd_gdImageColorResolveAlpha
+#define gdImageColorTransparent php_gd_gdImageColorTransparent
+#define gdImageCompare php_gd_gdImageCompare
+#define gdImageCopy php_gd_gdImageCopy
+#define gdImageCopyMerge php_gd_gdImageCopyMerge
+#define gdImageCopyMergeGray php_gd_gdImageCopyMergeGray
+#define gdImageCopyResampled php_gd_gdImageCopyResampled
+#define gdImageCopyResized php_gd_gdImageCopyResized
+#define gdImageCreate php_gd_gdImageCreate
+#define gdImageCreateFromGd php_gd_gdImageCreateFromGd
+#define gdImageCreateFromGd2 php_gd_gdImageCreateFromGd2
+#define gdImageCreateFromGd2Ctx php_gd_gdImageCreateFromGd2Ctx
+#define gdImageCreateFromGd2Part php_gd_gdImageCreateFromGd2Part
+#define gdImageCreateFromGd2PartCtx php_gd_gdImageCreateFromGd2PartCtx
+#define gdImageCreateFromGd2PartPtr php_gd_gdImageCreateFromGd2PartPtr
+#define gdImageCreateFromGd2Ptr php_gd_gdImageCreateFromGd2Ptr
+#define gdImageCreateFromGdCtx php_gd_gdImageCreateFromGdCtx
+#define gdImageCreateFromGdPtr php_gd_gdImageCreateFromGdPtr
+#define gdImageCreateFromGif php_gd_gdImageCreateFromGif
+#define gdImageCreateFromGifCtx php_gd_gdImageCreateFromGifCtx
+#define gdImageCreateFromGifSource php_gd_gdImageCreateFromGifSource
+#define gdImageCreateFromJpeg php_gd_gdImageCreateFromJpeg
+#define gdImageCreateFromJpegCtx php_gd_gdImageCreateFromJpegCtx
+#define gdImageCreateFromJpegPtr php_gd_gdImageCreateFromJpegPtr
+#define gdImageCreateFromPng php_gd_gdImageCreateFromPng
+#define gdImageCreateFromPngCtx php_gd_gdImageCreateFromPngCtx
+#define gdImageCreateFromPngPtr php_gd_gdImageCreateFromPngPtr
+#define gdImageCreateFromPngSource php_gd_gdImageCreateFromPngSource
+#define gdImageCreateFromWBMP php_gd_gdImageCreateFromWBMP
+#define gdImageCreateFromWBMPCtx php_gd_gdImageCreateFromWBMPCtx
+#define gdImageCreateFromWBMPPtr php_gd_gdImageCreateFromWBMPPtr
+#define gdImageCreateFromXbm php_gd_gdImageCreateFromXbm
+#define gdImageCreatePaletteFromTrueColor php_gd_gdImageCreatePaletteFromTrueColor
+#define gdImageCreateTrueColor php_gd_gdImageCreateTrueColor
+#define gdImageDashedLine php_gd_gdImageDashedLine
+#define gdImageDestroy php_gd_gdImageDestroy
+#define gdImageEllipse php_gd_gdImageEllipse
+#define gdImageFill php_gd_gdImageFill
+#define gdImageFilledArc php_gd_gdImageFilledArc
+#define gdImageFilledEllipse php_gd_gdImageFilledEllipse
+#define gdImageFilledPolygon php_gd_gdImageFilledPolygon
+#define gdImageFilledRectangle php_gd_gdImageFilledRectangle
+#define _gdImageFillTiled php_gd__gdImageFillTiled
+#define gdImageFillToBorder php_gd_gdImageFillToBorder
+#define gdImageGd php_gd_gdImageGd
+#define gdImageGd2 php_gd_gdImageGd2
+#define gdImageGd2Ptr php_gd_gdImageGd2Ptr
+#define gdImageGdPtr php_gd_gdImageGdPtr
+#define gdImageGetClip php_gd_gdImageGetClip
+#define gdImageGetPixel php_gd_gdImageGetPixel
+#define gdImageGetTrueColorPixel php_gd_gdImageGetTrueColorPixel
+#define gdImageGif php_gd_gdImageGif
+#define gdImageGifCtx php_gd_gdImageGifCtx
+#define gdImageGifPtr php_gd_gdImageGifPtr
+#define gdImageInterlace php_gd_gdImageInterlace
+#define gdImageJpeg php_gd_gdImageJpeg
+#define gdImageJpegCtx php_gd_gdImageJpegCtx
+#define gdImageJpegPtr php_gd_gdImageJpegPtr
+#define gdImageLine php_gd_gdImageLine
+#define gdImagePaletteCopy php_gd_gdImagePaletteCopy
+#define gdImagePng php_gd_gdImagePng
+#define gdImagePngCtx php_gd_gdImagePngCtx
+#define gdImagePngCtxEx php_gd_gdImagePngCtxEx
+#define gdImagePngEx php_gd_gdImagePngEx
+#define gdImagePngPtr php_gd_gdImagePngPtr
+#define gdImagePngPtrEx php_gd_gdImagePngPtrEx
+#define gdImagePngToSink php_gd_gdImagePngToSink
+#define gdImagePolygon php_gd_gdImagePolygon
+#define gdImageRectangle php_gd_gdImageRectangle
+#define gdImageRotate php_gd_gdImageRotate
+#define gdImageRotate180 php_gd_gdImageRotate180
+#define gdImageRotate270 php_gd_gdImageRotate270
+#define gdImageRotate45 php_gd_gdImageRotate45
+#define gdImageRotate90 php_gd_gdImageRotate90
+#define gdImageSaveAlpha php_gd_gdImageSaveAlpha
+#define gdImageSetAntiAliased php_gd_gdImageSetAntiAliased
+#define gdImageSetAntiAliasedDontBlend php_gd_gdImageSetAntiAliasedDontBlend
+#define gdImageSetBrush php_gd_gdImageSetBrush
+#define gdImageSetClip php_gd_gdImageSetClip
+#define gdImageSetPixel php_gd_gdImageSetPixel
+#define gdImageSetStyle php_gd_gdImageSetStyle
+#define gdImageSetThickness php_gd_gdImageSetThickness
+#define gdImageSetTile php_gd_gdImageSetTile
+#define gdImageSkewX php_gd_gdImageSkewX
+#define gdImageSkewY php_gd_gdImageSkewY
+#define gdImageString php_gd_gdImageString
+#define gdImageString16 php_gd_gdImageString16
+#define gdImageStringFT php_gd_gdImageStringFT
+#define gdImageStringFTEx php_gd_gdImageStringFTEx
+#define gdImageStringTTF php_gd_gdImageStringTTF
+#define gdImageStringUp php_gd_gdImageStringUp
+#define gdImageStringUp16 php_gd_gdImageStringUp16
+#define gdImageTrueColorToPalette php_gd_gdImageTrueColorToPalette
+#define gdImageWBMP php_gd_gdImageWBMP
+#define gdImageWBMPCtx php_gd_gdImageWBMPCtx
+#define gdImageWBMPPtr php_gd_gdImageWBMPPtr
+#define gdNewDynamicCtx php_gd_gdNewDynamicCtx
+#define gdNewDynamicCtxEx php_gd_gdNewDynamicCtxEx
+#define gdNewFileCtx php_gd_gdNewFileCtx
+#define gdNewSSCtx php_gd_gdNewSSCtx
+#define gdPutBuf php_gd_gdPutBuf
+#define gdPutC php_gd_gdPutC
+#define _gdPutColors php_gd__gdPutColors
+#define gdPutInt php_gd_gdPutInt
+#define gd_putout php_gd_gd_putout
+#define gdPutWord php_gd_gdPutWord
+#define gdSeek php_gd_gdSeek
+#define gdSinT php_gd_gdSinT
+#define gd_strtok_r php_gd_gd_strtok_r
+#define gdTell php_gd_gdTell
+#define getmbi php_gd_getmbi
+#define init_destination php_gd_init_destination
+#define init_source php_gd_init_source
+#define jpeg_gdIOCtx_dest php_gd_jpeg_gdIOCtx_dest
+#define jpeg_gdIOCtx_src php_gd_jpeg_gdIOCtx_src
+#define lsqrt php_gd_lsqrt
+#define printwbmp php_gd_printwbmp
+#define Putchar php_gd_Putchar
+#define putmbi php_gd_putmbi
+#define Putword php_gd_Putword
+#define readwbmp php_gd_readwbmp
+#define skipheader php_gd_skipheader
+#define skip_input_data php_gd_skip_input_data
+#define term_destination php_gd_term_destination
+#define term_source php_gd_term_source
+#define writewbmp php_gd_writewbmp
+#define ZeroDataBlock php_gd_ZeroDataBlock
+#endif /* HAVE_GD_BUNDLED */
+
 #ifdef PHP_EXPORTS
 #define PCRE_STATIC
 #define XML_STATIC
