[devel] Restored the ability to include optional pngusr.h
diff --git a/ANNOUNCE b/ANNOUNCE
index 2aefc86..9e58364 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -161,9 +161,9 @@
     in the new installed header file pnglibconf.h
   Removed the xcode project because it has not been updated to work
     with libpng-1.5.0.
-  Removed the ability to include optional pngusr.h
 
 version 1.5.0beta18 [April 17, 2010]
+  Restored the ability to include optional pngusr.h
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index dae7779..2690073 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2645,6 +2645,7 @@
   Removed the ability to include optional pngusr.h
 
 version 1.5.0beta18 [April 17, 2010]
+  Restored the ability to include optional pngusr.h
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/pngpriv.h b/pngpriv.h
index 95fae8e..72439a6 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -25,6 +25,9 @@
 #define PNGPRIV_H
 
 #define PNGLIB_BUILD
+#ifdef PNG_USER_CONFIG
+#  include "pngusr.h"
+#endif
 #include "png.h"
 #include "pnginfo.h"
 #include "pngstruct.h"
@@ -77,6 +80,18 @@
 #  define PNG_WARNINGS_SUPPORTED
 #endif
 
+/* If warnings or errors are turned off the code is disabled
+ * or redirected here.
+ */
+#ifndef PNG_WARNINGS_SUPPORTED
+#  define png_warning(s1,s2) ((void)0)
+#  define png_chunk_warning(s1,s2) ((void)0)
+#endif
+#ifndef PNG_ERROR_TEXT_SUPPORTED
+#  define png_error(s1,s2) png_err(s1)
+#  define png_chunk_error(s1,s2) png_err(s1)
+#endif
+
 /* Added at libpng version 1.4.0 */
 #if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
 #  define PNG_CHECK_cHRM_SUPPORTED