[libpng15] Added versioning to pnglibconf.h comments.
diff --git a/ANNOUNCE b/ANNOUNCE
index af45e4d..d448ae1 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
 
-Libpng 1.5.7beta02 - November 5, 2011
+Libpng 1.5.7beta02 - November 8, 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.
@@ -43,7 +43,7 @@
     just the changes that definitely improve speed and remain simple.
     The changes also slightly increase the clarity of the code.
 
-Version 1.5.7beta02 [November 5, 2011]
+Version 1.5.7beta02 [November 8, 2011]
   Check compression_type parameter in png_get_iCCP and remove spurious
     casts. The compression_type parameter is always assigned to, so must
     be non-NULL. The cast of the profile length potentially truncated the
@@ -57,6 +57,7 @@
     tested in the future.
   Updated scripts/pnglibconf.mak and scripts/makefile.std to handle the
     new PNG_JOIN macro.
+  Added versioning to pnglibconf.h comments.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
 (subscription required; visit
diff --git a/CHANGES b/CHANGES
index d789b80..392092d 100644
--- a/CHANGES
+++ b/CHANGES
@@ -3688,7 +3688,7 @@
     just the changes that definitely improve speed and remain simple.
     The changes also slightly increase the clarity of the code.
 
-Version 1.5.7beta02 [November 5, 2011]
+Version 1.5.7beta02 [November 8, 2011]
   Check compression_type parameter in png_get_iCCP and remove spurious
     casts. The compression_type parameter is always assigned to, so must
     be non-NULL. The cast of the profile length potentially truncated the
@@ -3702,6 +3702,7 @@
     tested in the future.
   Updated scripts/pnglibconf.mak and scripts/makefile.std to handle the
     new PNG_JOIN macro.
+  Added versioning to pnglibconf.h comments.
 
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net
 (subscription required; visit
diff --git a/scripts/makefile.std b/scripts/makefile.std
index 97f5b2f..0d0c5e5 100644
--- a/scripts/makefile.std
+++ b/scripts/makefile.std
@@ -50,9 +50,9 @@
 
 # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
 # copy this if the following doesn't work.
-pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
+pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk ANNOUNCE
 	$(RM_F) $@ dfn?.out
-	$(AWK) -f scripts/options.awk out=dfn1.out\
+	$(AWK) -f scripts/options.awk out=dfn1.out ANNOUNCE\
 	    scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
 	$(AWK) -f scripts/options.awk out=dfn2.out dfn1.out 1>&2
 	cp dfn2.out $@
diff --git a/scripts/options.awk b/scripts/options.awk
index a30d668..dc09e12 100755
--- a/scripts/options.awk
+++ b/scripts/options.awk
@@ -1,7 +1,7 @@
 #!/bin/awk -f
 # scripts/options.awk - library build configuration control
 #
-# last changed in libpng version 1.5.0 - January 6, 2011
+# last changed in libpng version 1.5.7 - November 11, 2011
 #
 # Copyright (c) 1998-2011 Glenn Randers-Pehrson
 #
@@ -32,6 +32,7 @@
 BEGIN{
    out="/dev/null"              # intermediate, preprocessed, file
    pre=-1                       # preprocess (first line)
+   version=""                   # version information
    err=0                        # in-line exit sets this
    start="PNG_DEFN_MAGIC-"      # Arbitrary start
    end="-PNG_DEFN_END"          # Arbitrary end
@@ -86,6 +87,17 @@
    }
 }
 
+# While pre-processing if the filename is ANNOUNCE then just look for a line
+# which gives the version information for this build.
+pre && FILENAME ~ /ANNOUNCE$/ && version == "" && $1 == "Libpng"{
+   version=$0
+   print "version =", version >out
+}
+
+pre && FILENAME ~ /ANNOUNCE$/{
+   next
+}
+
 # variable=value
 #   Sets the given variable to the given value (the syntax is fairly
 #   free form, except for deb (you are expected to understand how to
@@ -95,6 +107,11 @@
 #   rest of the actions, so the variable settings happen during
 #   preprocessing but are recorded in the END action too.  This
 #   allows them to be set on the command line too.
+$0 ~ /^[ 	]*version[ 	]*=/{
+   sub(/^[  ]*version[  ]*=[  ]*/, "")
+   version = $0
+   next
+}
 $0 ~ /^[ 	]*everything[ 	=]*off[ 	]*$/{
    everything = "off"
    next
@@ -166,6 +183,19 @@
    next
 }
 
+# version
+#   Inserts a version comment
+$1 == "version" && NF == 1{
+   if (version == "") {
+      print "ERROR: no version string set"
+      err = 1 # prevent END{} running
+      exit 1
+   }
+
+   print comment, version, cend >out
+   next
+}
+
 # file output input protect
 #   Informational: the official name of the input file (without
 #   make generated local directories), the official name of the
diff --git a/scripts/pnglibconf.h.prebuilt b/scripts/pnglibconf.h.prebuilt
index 8022a5a..a8e12b0 100644
--- a/scripts/pnglibconf.h.prebuilt
+++ b/scripts/pnglibconf.h.prebuilt
@@ -3,7 +3,7 @@
 
 /* pnglibconf.h - library build configuration */
 
-/* libpng version 1.5.4 - last changed on June 22, 2011 */
+/* libpng version 1.5.7beta02 - November 8, 2011 */
 
 /* Copyright (c) 1998-2011 Glenn Randers-Pehrson */
 
diff --git a/scripts/pnglibconf.mak b/scripts/pnglibconf.mak
index bdc1698..3cdb46a 100755
--- a/scripts/pnglibconf.mak
+++ b/scripts/pnglibconf.mak
@@ -41,11 +41,11 @@
 	$(COPY) dfn3.out $@
 	$(DELETE) dfn.c dfn1.out dfn2.out dfn3.out
 
-pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk
+pnglibconf.dfn: $(srcdir)/scripts/pnglibconf.dfa $(srcdir)/scripts/options.awk $(srcdir)/ANNOUNCE
 	$(DELETE) $@ dfn1.out dfn2.out
 	$(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
 	$(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
-	$(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out\
+	$(AWK) -f $(srcdir)/scripts/options.awk out=dfn1.out $(srcdir)/ANNOUNCE\
 	    $(srcdir)/scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
 	$(AWK) -f $(srcdir)/scripts/options.awk out=dfn2.out dfn1.out 1>&2
 	$(COPY) dfn2.out $@