[devel] Don't include standard header files in png.h while building the symbol

table, to avoid cpp failure on SunOS (introduced PNG_BUILDING_SYMBOL_TABLE
macro).
diff --git a/ANNOUNCE b/ANNOUNCE
index 36a2378..7187aea 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.2rc03 - March 24, 2011
+Libpng 1.5.2rc03 - March 25, 2011
 
 This is not intended to be a public release.  It will be replaced
 within a few weeks by a public version or by another test version.
@@ -64,7 +64,9 @@
   Fixed a bug (present since libpng-1.0.7) that makes png_handle_sPLT() fail
     to compile when PNG_NO_POINTER_INDEXING is defined (Chubanov Kirill)
 
-Version 1.5.2rc03 [March 24, 2011]
+Version 1.5.2rc03 [March 25, 2011]
+  Don't include standard header files in png.h while building the symbol table,
+    to avoid cpp failure on SunOS (introduced PNG_BUILDING_SYMBOL_TABLE macro).
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index b2813b6..6f553d8 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3280,7 +3280,9 @@
   Fixed a bug (present since libpng-1.0.7) that makes png_handle_sPLT() fail
     to compile when PNG_NO_POINTER_INDEXING is defined (Chubanov Kirill)
 
-Version 1.5.2rc03 [March 24, 2011]
+Version 1.5.2rc03 [March 25, 2011]
+  Don't include standard header files in png.h while building the symbol table,
+    to avoid cpp failure on SunOS (introduced PNG_BUILDING_SYMBOL_TABLE macro).
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/Makefile.am b/Makefile.am
index 18f87b4..7b8c494 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -124,7 +124,7 @@
 SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
 		-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
 		-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
-		-DPNG_NO_USE_READ_MACROS
+		-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
 
 .dfn.out:
 	rm -f $@ dfn.c dfn?.out
diff --git a/Makefile.in b/Makefile.in
index d2febdd..5410f1b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -362,7 +362,7 @@
 SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
 		-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
 		-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
-		-DPNG_NO_USE_READ_MACROS
+		-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
 
 all: config.h
 	$(MAKE) $(AM_MAKEFLAGS) all-am
diff --git a/png.h b/png.h
index 353f003..ea1f184 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
 
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.5.2rc03 - March 24, 2011
+ * libpng version 1.5.2rc03 - March 25, 2011
  * Copyright (c) 1998-2011 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
  * Authors and maintainers:
  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  *   libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- *   libpng versions 0.97, January 1998, through 1.5.2rc03 - March 24, 2011: Glenn
+ *   libpng versions 0.97, January 1998, through 1.5.2rc03 - March 25, 2011: Glenn
  *   See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -180,7 +180,7 @@
  *
  * This code is released under the libpng license.
  *
- * libpng versions 1.2.6, August 15, 2004, through 1.5.2rc03, March 24, 2011, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.2rc03, March 25, 2011, are
  * Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.2.5
  * with the following individual added to the list of Contributing Authors:
@@ -292,7 +292,7 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    March 24, 2011
+ *    March 25, 2011
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
@@ -356,7 +356,7 @@
 /* Version information for png.h - this should match the version in png.c */
 #define PNG_LIBPNG_VER_STRING "1.5.2rc03"
 #define PNG_HEADER_VERSION_STRING \
-     " libpng version 1.5.2rc03 - March 24, 2011\n"
+     " libpng version 1.5.2rc03 - March 25, 2011\n"
 
 #define PNG_LIBPNG_VER_SONUM   15
 #define PNG_LIBPNG_VER_DLLNUM  15
@@ -407,18 +407,23 @@
 #endif
 
 #ifndef PNG_VERSION_INFO_ONLY
-/* Standard header files (not needed for the version info) */
-#  ifdef PNG_SETJMP_SUPPORTED
-#    include <setjmp.h>
-#  endif
+#  ifndef PNG_BUILDING_SYMBOL_TABLE
+  /*
+   *   Standard header files (not needed for the version info or while
+   *   building symbol table -- see scripts/pnglibconf.dfa)
+   */
+#    ifdef PNG_SETJMP_SUPPORTED
+#      include <setjmp.h>
+#    endif
 
-/* Need the time information for converting tIME chunks, it
- * defines struct tm:
- */
-#ifdef PNG_CONVERT_tIME_SUPPORTED
-   /* "time.h" functions are not supported on all operating systems */
-#  include <time.h>
-#endif
+    /* Need the time information for converting tIME chunks, it
+     * defines struct tm:
+     */
+#    ifdef PNG_CONVERT_tIME_SUPPORTED
+       /* "time.h" functions are not supported on all operating systems */
+#      include <time.h>
+#    endif
+#  endif
 
 /* Machine specific configuration. */
 #  include "pngconf.h"
diff --git a/pngconf.h b/pngconf.h
index 7c30b29..b49ea0a 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -22,29 +22,31 @@
 #ifndef PNGCONF_H
 #define PNGCONF_H
 
+#ifndef PNG_BUILDING_SYMBOL_TABLE
 /* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
  * definition file for  machine specific limits, this may impact the
  * correctness of the definitons below (see uses of INT_MAX).
  */
-#ifndef PNG_NO_LIMITS_H
-#  include <limits.h>
-#endif
+#  ifndef PNG_NO_LIMITS_H
+#    include <limits.h>
+#  endif
 
 /* For the memory copy APIs (i.e. the standard definitions of these),
  * because this file defines png_memcpy and so on the base APIs must
  * be defined here.
  */
-#ifdef BSD
-#  include <strings.h>
-#else
-#  include <string.h>
-#endif
+#  ifdef BSD
+#    include <strings.h>
+#  else
+#    include <string.h>
+#  endif
 
 /* For png_FILE_p - this provides the standard definition of a
  * FILE
  */
-#ifdef PNG_STDIO_SUPPORTED
-#  include <stdio.h>
+#  ifdef PNG_STDIO_SUPPORTED
+#    include <stdio.h>
+#  endif
 #endif
 
 /* This controls optimization of the reading of 16 and 32 bit values