Imported from libpng-1.2.4beta2.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 85cfb53..3787468 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,17 +1,24 @@
 
-Libpng 1.2.4beta1 - May 25, 2002
+Libpng 1.2.4beta2 - June 20, 2002
 
 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.
 
 Changes since the last public release (1.2.3):
 
-version 1.2.4beta1 [May 25, 2002]
+version 1.2.4beta1 [May 24, 2002]
   Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
   Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
   Added missing "\" before closing double quote in makefile.gcmmx.
   Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
     functions.
+version 1.2.4beta2 [June 20, 2002]
+  Plugged memory leak of png_ptr->current_text (Matt Holgate).
+  Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
+  Added -soname to the loader flags in makefile.dec, makefile.sgi, and
+    makefile.sggcc.
+  Added "test-installed" targets to makefile.linux, makefile.gcmmx,
+    makefile.sgi, and makefile.sggcc.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index c0f3c17..7a6cc03 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1125,12 +1125,19 @@
   Minor cosmetic changes to 15 makefiles, e.g., $(DI) = $(DESTDIR)/$(INCDIR).
   Revised projects/msvc/README.txt
   Changed -lpng to -lpngNN in LDFLAGS in several makefiles.
-version 1.2.4beta1 [May 25, 2002]
+version 1.2.4beta1 [May 24, 2002]
   Added libpng.pc and libpng-config to "all:" target in 16 makefiles.
   Fixed bug in 16 makefiles: $(DESTDIR)/$(LIBPATH) to $(DESTDIR)$(LIBPATH)
   Added missing "\" before closing double quote in makefile.gcmmx.
   Plugged various memory leaks; added png_malloc_warn() and png_set_text_2()
     functions.
+version 1.2.4beta2 [June 20, 2002]
+  Plugged memory leak of png_ptr->current_text (Matt Holgate).
+  Check for buffer overflow before reading CRC in pngpread.c (Warwick Allison)
+  Added -soname to the loader flags in makefile.dec, makefile.sgi, and
+    makefile.sggcc.
+  Added "test-installed" targets to makefile.linux, makefile.gcmmx,
+    makefile.sgi, and makefile.sggcc.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index b192880..22feaf2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.2.4beta1 - May 25, 2002
+Installing libpng version 1.2.4beta2 - June 20, 2002
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,8 +10,8 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.2.4beta1" or "lpng109" and "zlib-1.1.3"
-or "zlib113") so that you have directories called "zlib" and "libpng".
+might be called "libpng-1.2.4beta2" or "lpng109" and "zlib-1.1.4"
+or "zlib114") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
 
@@ -35,6 +35,10 @@
              wince.txt
           scripts
              makefile.*
+             libpng*.in
+          mangle
+             makefile.*
+             mangle.in
           pngtest.png
           etc.
       zlib
@@ -64,8 +68,8 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4beta1)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4beta1,
+ makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4beta2)
+ makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.4beta2,
                        uses assembler code tuned for Intel MMX platform)
  makefile.gcc      =>  Generic makefile (gcc, creates static libpng.a)
  makefile.knr      =>  Archaic UNIX Makefile that converts files with
@@ -86,10 +90,10 @@
  makefile.ne0bsd  =>  NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
  makefile.openbsd  =>  OpenBSD makefile
  makefile.sgi      =>  Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.4beta1)
+ makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.4beta2)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.4beta1)
- makefile.so9      =>  Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.4beta1)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.4beta2)
+ makefile.so9      =>  Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.4beta2)
  makefile.32sunu   =>  Sun Ultra 32-bit makefile
  makefile.64sunu   =>  Sun Ultra 64-bit makefile
  makefile.sco      =>  For SCO OSr5  ELF and Unixware 7 with Native cc
@@ -142,6 +146,24 @@
 Most of the makefiles will allow you to run "make install" to
 put the library in its final resting place (if you want to
 do that, run "make install" in the zlib directory first if necessary).
+Some also allow you to run "make test-installed" after you have
+run "make install".  This will build and run executables called "pngtesti"
+and "mangle/pngtestm".
+
+The files that are presently available in the mangle directory include the
+following.  The makefiles are automatically run by the corresponding makefiles
+in the scripts directory when you run "make", "make install", or
+"make test-installed".
+
+ mangle.in        =>  Function-decoration macros added to png.h by the
+                      makefiles.
+ makefile.linux   =>  Linux/ELF makefile
+                      (gcc, creates libpng12m.so.0.1.2.4beta2)
+ makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
+                      libpng12.so.0m.1.2.4beta2, uses assembler code
+                      tuned for Intel MMX platform)
+ makefile.sgi     =>  Silicon Graphics (cc, creates libpng12m.so)
+ makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng12m.so)
 
 Further information can be found in the README and libpng.txt
 files, in the individual makefiles, in png.h, in the README files in
diff --git a/KNOWNBUG b/KNOWNBUG
index ca3f118..e3f4cca 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,9 +1,18 @@
 
-Known bugs in libpng version 1.2.4beta1
+Known bugs in libpng version 1.2.4beta2
 
-1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
+1. May 28, 2002:  Makefile.so9 has bugs.  The last line under the
+   install-headers target should be
+
+	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+
+   and the last line under the install-static target should be
+
+
+2. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
    reading interlaced PNG files, when assembler code is enabled.
 
    STATUS: Under investigation.  The change to pnggccrd.c in libpng-1.2.1
-   fixed a problem under FreeBSD but not the problem with NetBSD.
+   fixed a problem under FreeBSD but not the problem with NetBSD, which
+   still fails as of libpng-1.2.2rc1.
 
diff --git a/LICENSE b/LICENSE
index 05abcb2..bf40c1a 100644
--- a/LICENSE
+++ b/LICENSE
@@ -8,7 +8,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng versions 1.0.7, July 1, 2000, through 1.2.4beta1, May 25, 2002, are
+libpng versions 1.0.7, July 1, 2000, through 1.2.4beta2, June 20, 2002, are
 Copyright (c) 2000-2002 Glenn Randers-Pehrson
 and are distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -99,4 +99,4 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-May 25, 2002
+June 20, 2002
diff --git a/README b/README
index 90706a0..6d81a0f 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.2.4beta1 - May 25, 2002 (shared library 2.1)
+README for libpng 1.2.4beta2 - June 20, 2002 (shared library 12.0)
 See the note about version numbers near the top of png.h
 
 See INSTALL for instructions on how to install libpng.
@@ -187,9 +187,9 @@
        descrip.mms      =>  VMS makefile for MMS or MMK
        makefile.std     =>  Generic UNIX makefile (cc, creates static libpng.a)
        makefile.linux   =>  Linux/ELF makefile
-                            (gcc, creates libpng12.so.0.1.2.4beta1)
+                            (gcc, creates libpng12.so.0.1.2.4beta2)
        makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
-                            libpng12.so.0.1.2.4beta1, uses assembler code
+                            libpng12.so.0.1.2.4beta2, uses assembler code
                             tuned for Intel MMX platform)
        makefile.gcc     =>  Generic makefile (gcc, creates static libpng.a)
        makefile.knr     =>  Archaic UNIX Makefile that converts files with
@@ -210,12 +210,12 @@
        makefile.ne0bsd =>  NetBSD/cc makefile, PNGGCCRD, makes libpng0.so
        makefile.openbsd =>  OpenBSD makefile
        makefile.sgi     =>  Silicon Graphics IRIX (cc, creates static lib)
-       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.4beta1)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.4beta2)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng12.so.0.1.2.4beta1)
+                            (gcc, creates libpng12.so.0.1.2.4beta2)
        makefile.so9     =>  Solaris 9 makefile
-                            (gcc, creates libpng12.so.0.1.2.4beta1)
+                            (gcc, creates libpng12.so.0.1.2.4beta2)
        makefile.32sunu  =>  Sun Ultra 32-bit makefile
        makefile.64sunu  =>  Sun Ultra 64-bit makefile
        makefile.sco     =>  For SCO OSr5  ELF and Unixware 7 with Native cc
@@ -244,6 +244,16 @@
        makevms.com      =>  VMS build script
        pngdef.pas       =>  Defines for a png32bd.dll with Borland C++ 4.5
        SCOPTIONS.ppc    =>  Used with smakefile.ppc
+      mangle        =>  Directory containing scripts to build libpng12m.so:
+       mangle.in        =>  Function-decoration macros added to png.h by the
+                            makefiles.
+       makefile.linux   =>  Linux/ELF makefile
+                            (gcc, creates libpng12m.so.0.1.2.4beta2)
+       makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
+                            libpng12.so.0m.1.2.4beta2, uses assembler code
+                            tuned for Intel MMX platform)
+       makefile.sgi     =>  Silicon Graphics (cc, creates libpng12m.so)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng12m.so)
 
 Good luck, and happy coding.
 
diff --git a/Y2KINFO b/Y2KINFO
index 616a2e8..88f7242 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      May 25, 2002
+      June 20, 2002
 
       Since the PNG Development group is an ad-hoc body, we can't make
       an official declaration.
 
       This is your unofficial assurance that libpng from version 0.71 and
-      upward through 1.2.4beta1 are Y2K compliant.  It is my belief that earlier
+      upward through 1.2.4beta2 are Y2K compliant.  It is my belief that earlier
       versions were also Y2K compliant.
 
       Libpng only has three year fields.  One is a 2-byte unsigned integer
diff --git a/configure b/configure
index 453afa7..626ac39 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 echo "
-  There is no \"configure\" script for Libpng-1.2.4beta1.  Instead, please
+  There is no \"configure\" script for Libpng-1.2.4beta2.  Instead, please
   copy the appropriate makefile for your system from the \"scripts\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/contrib/msvctest/msvctest.dsp b/contrib/msvctest/msvctest.dsp
index 5a8fcc2..afe93a5 100644
--- a/contrib/msvctest/msvctest.dsp
+++ b/contrib/msvctest/msvctest.dsp
@@ -54,7 +54,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng12.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll\libpng13.lib /nologo /subsystem:console /machine:I386
 # Begin Special Build Tool
 OutDir=.\dll
 SOURCE="$(InputPath)"
@@ -84,7 +84,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng12d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbg\libpng13d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 # Begin Special Build Tool
 OutDir=.\dll_dbg
 SOURCE="$(InputPath)"
@@ -114,7 +114,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /machine:I386
-# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng12a.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_asm\libpng13a.lib /nologo /subsystem:console /machine:I386
 # Begin Special Build Tool
 OutDir=.\dll_asm
 SOURCE="$(InputPath)"
@@ -144,7 +144,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng12b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 ..\..\projects\msvc\win32\libpng\dll_dbga\libpng13b.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
 # Begin Special Build Tool
 OutDir=.\dll_dbga
 SOURCE="$(InputPath)"
diff --git a/contrib/visupng/VisualPng.dsp b/contrib/visupng/VisualPng.dsp
index 7eb9932..0093cbf 100644
--- a/contrib/visupng/VisualPng.dsp
+++ b/contrib/visupng/VisualPng.dsp
@@ -59,8 +59,8 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng12.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
-# ADD LINK32 libpng12.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
+# ADD BASE LINK32 libpng13.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"libpng" /libpath:"zlib"
+# ADD LINK32 libpng13.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
 # Begin Special Build Tool
 OutDir=.\dll
 SOURCE="$(InputPath)"
@@ -92,9 +92,9 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng12.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
+# ADD BASE LINK32 libpng13.lib zlibd.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"libpng" /libpath:"zlib"
 # SUBTRACT BASE LINK32 /nodefaultlib
-# ADD LINK32 libpng12d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
+# ADD LINK32 libpng13d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
 # SUBTRACT LINK32 /nodefaultlib
 # Begin Special Build Tool
 OutDir=.\dll_dbg
@@ -128,7 +128,7 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng12.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
+# ADD BASE LINK32 libpng13.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\dll"
 # ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /machine:I386 /libpath:"..\..\projects\msvc\win32\libpng\lib"
 # Begin Special Build Tool
 OutDir=.\lib
@@ -161,7 +161,7 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 libpng12d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
+# ADD BASE LINK32 libpng13d.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\dll_dbg"
 # SUBTRACT BASE LINK32 /nodefaultlib
 # ADD LINK32 libpng.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /debug /machine:I386 /nodefaultlib:"libc" /pdbtype:sept /libpath:"..\..\projects\msvc\win32\libpng\lib_dbg"
 # SUBTRACT LINK32 /nodefaultlib
diff --git a/example.c b/example.c
index a72bedc..1cc450f 100644
--- a/example.c
+++ b/example.c
@@ -169,11 +169,11 @@
    png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
        &interlace_type, int_p_NULL, int_p_NULL);
 
-/**** Set up the data transformations you want.  Note that these are all
- **** optional.  Only call them if you want/need them.  Many of the
- **** transformations only work on specific types of images, and many
- **** are mutually exclusive.
- ****/
+/* Set up the data transformations you want.  Note that these are all
+ * optional.  Only call them if you want/need them.  Many of the
+ * transformations only work on specific types of images, and many
+ * are mutually exclusive.
+ */
 
    /* tell libpng to strip 16 bit/color files down to 8 bits/color */
    png_set_strip_16(png_ptr);
diff --git a/libpng.3 b/libpng.3
index 8f70172..2f9f5f4 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "May 25, 2002"
+.TH LIBPNG 3 "June 20, 2002"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.4beta1
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.4beta2
 .SH SYNOPSIS
 \fI\fB
 
@@ -791,7 +791,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.2.4beta1 - May 25, 2002
+ libpng version 1.2.4beta2 - June 20, 2002
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998-2002 Glenn Randers-Pehrson
@@ -3641,13 +3641,13 @@
 
 .SH IX. Y2K Compliance in libpng
 
-May 25, 2002
+June 20, 2002
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.4beta1 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.4beta2 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
@@ -3778,7 +3778,7 @@
  1.2.2               12    10202  12.so.0.1.2.2
  1.2.3rc1-6          12    10203  12.so.0.1.2.3rc1-6
  1.2.3               12    10203  12.so.0.1.2.3
- 1.2.4beta1          13    10204  12.so.0.1.2.4beta1 
+ 1.2.4beta1-2        13    10204  12.so.0.1.2.4beta1-2
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -3836,7 +3836,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.2.4beta1 - May 25, 2002:
+Libpng version 1.2.4beta2 - June 20, 2002:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3853,7 +3853,7 @@
 If you modify libpng you may insert additional notices immediately following
 this sentence.
 
-libpng versions 1.0.7, July 1, 2000, through 1.2.4beta1, May 25, 2002, are
+libpng versions 1.0.7, July 1, 2000, through 1.2.4beta2, June 20, 2002, are
 Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
 distributed according to the same disclaimer and license as libpng-1.0.6
 with the following individuals added to the list of Contributing Authors
@@ -3945,7 +3945,7 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-May 25, 2002
+June 20, 2002
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index 2304ab1..c65d059 100644
--- a/libpng.txt
+++ b/libpng.txt
@@ -1,6 +1,6 @@
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.2.4beta1 - May 25, 2002
+ libpng version 1.2.4beta2 - June 20, 2002
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998-2002 Glenn Randers-Pehrson
@@ -2850,13 +2850,13 @@
 
 IX. Y2K Compliance in libpng
 
-May 25, 2002
+June 20, 2002
 
 Since the PNG Development group is an ad-hoc body, we can't make
 an official declaration.
 
 This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.2.4beta1 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.4beta2 are Y2K compliant.  It is my belief that earlier
 versions were also Y2K compliant.
 
 Libpng only has three year fields.  One is a 2-byte unsigned integer that
diff --git a/libpngpf.3 b/libpngpf.3
index 8dcba8f..5195dc4 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "May 25, 2002"
+.TH LIBPNGPF 3 "June 20, 2002"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.4beta1
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.4beta2
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
diff --git a/png.5 b/png.5
index 2d23a58..6b29f7d 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "May 25, 2002"
+.TH PNG 5 "June 20, 2002"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 0a3960c..eda9ab1 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.2.4beta1 - May 25, 2002
+ * libpng version 1.2.4beta2 - June 20, 2002
  * Copyright (c) 1998-2002 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.)
@@ -13,14 +13,14 @@
 #include "png.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_4beta1 Your_png_h_is_not_version_1_2_4beta1;
+typedef version_1_2_4beta2 Your_png_h_is_not_version_1_2_4beta2;
 
 /* Version information for C files.  This had better match the version
  * string defined in png.h.  */
 
 #ifdef PNG_USE_GLOBAL_ARRAYS
 /* png_libpng_ver was changed to a function in version 1.0.5c */
-const char png_libpng_ver[18] = "1.2.4beta1";
+const char png_libpng_ver[18] = "1.2.4beta2";
 
 /* png_sig was changed to a function in version 1.0.5c */
 /* Place to hold the signature string for a PNG file. */
@@ -663,7 +663,7 @@
 png_get_copyright(png_structp png_ptr)
 {
    if (png_ptr != NULL || png_ptr == NULL)  /* silence compiler warning */
-   return ((png_charp) "\n libpng version 1.2.4beta1 - May 25, 2002\n\
+   return ((png_charp) "\n libpng version 1.2.4beta2 - June 20, 2002\n\
    Copyright (c) 1998-2002 Glenn Randers-Pehrson\n\
    Copyright (c) 1996-1997 Andreas Dilger\n\
    Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
@@ -681,8 +681,8 @@
 {
    /* Version of *.c files used when building libpng */
    if(png_ptr != NULL) /* silence compiler warning about unused png_ptr */
-      return((png_charp) "1.2.4beta1");
-   return((png_charp) "1.2.4beta1");
+      return((png_charp) "1.2.4beta2");
+   return((png_charp) "1.2.4beta2");
 }
 
 png_charp PNGAPI
diff --git a/png.h b/png.h
index a62b75f..a076dc0 100644
--- a/png.h
+++ b/png.h
@@ -1,6 +1,6 @@
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.2.4beta1 - May 25, 2002
+ * libpng version 1.2.4beta2 - June 20, 2002
  * Copyright (c) 1998-2002 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.)
@@ -8,7 +8,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.2.4beta1 - May 25, 2002: Glenn
+ *  libpng versions 0.97, January 1998, through 1.2.4beta2 - June 20, 2002: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -88,7 +88,7 @@
  *    1.2.2                   12    10202  12.so.0.1.2.2
  *    1.2.3rc1-6              12    10203  12.so.0.1.2.3rc1-6
  *    1.2.3                   12    10203  12.so.0.1.2.3
- *    1.2.4beta1              13    10204  12.so.0.1.2.4beta1 
+ *    1.2.4beta1-2            13    10204  12.so.0.1.2.4beta1-2
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
@@ -118,7 +118,7 @@
  * If you modify libpng you may insert additional notices immediately following
  * this sentence.
  *
- * libpng versions 1.0.7, July 1, 2000, through 1.2.4beta1, May 25, 2002, are
+ * libpng versions 1.0.7, July 1, 2000, through 1.2.4beta2, June 20, 2002, are
  * Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
  * distributed according to the same disclaimer and license as libpng-1.0.6
  * with the following individuals added to the list of Contributing Authors
@@ -223,13 +223,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    May 25, 2002
+ *    June 20, 2002
  *
  *    Since the PNG Development group is an ad-hoc body, we can't make
  *    an official declaration.
  *
  *    This is your unofficial assurance that libpng from version 0.71 and
- *    upward through 1.2.4beta1 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.2.4beta2 are Y2K compliant.  It is my belief that earlier
  *    versions were also Y2K compliant.
  *
  *    Libpng only has three year fields.  One is a 2-byte unsigned integer
@@ -285,7 +285,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.4beta1"
+#define PNG_LIBPNG_VER_STRING "1.2.4beta2"
 
 #define PNG_LIBPNG_VER_SONUM   0
 #define PNG_LIBPNG_VER_DLLNUM  %DLLNUM%
@@ -297,7 +297,7 @@
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
 
-#define PNG_LIBPNG_VER_BUILD  1
+#define PNG_LIBPNG_VER_BUILD  2
 
 #define PNG_LIBPNG_BUILD_ALPHA    1
 #define PNG_LIBPNG_BUILD_BETA     2
@@ -374,7 +374,7 @@
  */
 #ifdef PNG_USE_GLOBAL_ARRAYS
 PNG_EXPORT_VAR (const char) png_libpng_ver[18];
-  /* need room for 99.99.99beta99z*/
+  /* need room for 99.99.99beta99z */
 #else
 #define png_libpng_ver png_get_header_ver(NULL)
 #endif
@@ -600,7 +600,7 @@
    png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
 
    /* The following is informational only on read, and not used on writes. */
-   png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4)*/
+   png_byte channels;       /* number of data channels per pixel (1, 2, 3, 4) */
    png_byte pixel_depth;    /* number of bits per pixel */
    png_byte spare_byte;     /* to align the data, and for future use */
    png_byte signature[8];   /* magic bytes read by libpng from start of file */
@@ -890,7 +890,7 @@
 #define PNG_KEYWORD_MAX_LENGTH     79
 
 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */
-#define PNG_MAX_PALETTE_LENGTH	   256
+#define PNG_MAX_PALETTE_LENGTH    256
 
 /* These determine if an ancillary chunk's data has been successfully read
  * from the PNG header, or if the application has filled in the corresponding
@@ -1009,7 +1009,7 @@
    png_voidp error_ptr;       /* user supplied struct for error functions */
    png_rw_ptr write_data_fn;  /* function for writing output data */
    png_rw_ptr read_data_fn;   /* function for reading input data */
-   png_voidp io_ptr;          /* ptr to application struct for I/O functions*/
+   png_voidp io_ptr;          /* ptr to application struct for I/O functions */
 
 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
    png_user_transform_ptr read_user_transform_fn; /* user read transform */
@@ -1274,9 +1274,9 @@
 
 
 /* This prevents a compiler error in png.c if png.c and png.h are both at
-   version 1.2.4beta1
+   version 1.2.4beta2
  */
-typedef png_structp version_1_2_4beta1;
+typedef png_structp version_1_2_4beta2;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -1360,6 +1360,7 @@
 
 /* Initialize the info structure (old interface - DEPRECATED) */
 extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
+#undef png_info_init
 #define png_info_init(info_ptr) png_info_init_3(&info_ptr, sizeof(png_info));
 extern PNG_EXPORT(void,png_info_init_3) PNGARG((png_infopp info_ptr,
     png_size_t png_info_struct_size));
@@ -1535,11 +1536,11 @@
 extern PNG_EXPORT(void,png_read_update_info) PNGARG((png_structp png_ptr,
    png_infop info_ptr));
 
-/* read a one or more rows of image data.*/
+/* read a one or more rows of image data. */
 extern PNG_EXPORT(void,png_read_rows) PNGARG((png_structp png_ptr,
    png_bytepp row, png_bytepp display_row, png_uint_32 num_rows));
 
-/* read a row of data.*/
+/* read a row of data. */
 extern PNG_EXPORT(void,png_read_row) PNGARG((png_structp png_ptr,
    png_bytep row,
    png_bytep display_row));
@@ -2327,15 +2328,15 @@
 
 /* Added to version 1.2.0 */
 #if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01		/* not user-settable */
-#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02		/* not user-settable */
+#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED  0x01  /* not user-settable */
+#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU    0x02  /* not user-settable */
 #define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  0x04
 #define PNG_ASM_FLAG_MMX_READ_INTERLACE    0x08
 #define PNG_ASM_FLAG_MMX_READ_FILTER_SUB   0x10
 #define PNG_ASM_FLAG_MMX_READ_FILTER_UP    0x20
 #define PNG_ASM_FLAG_MMX_READ_FILTER_AVG   0x40
 #define PNG_ASM_FLAG_MMX_READ_FILTER_PAETH 0x80
-#define PNG_ASM_FLAGS_INITIALIZED          0x80000000	/* not user-settable */
+#define PNG_ASM_FLAGS_INITIALIZED          0x80000000  /* not user-settable */
 
 #define PNG_MMX_READ_FLAGS ( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW  \
                            | PNG_ASM_FLAG_MMX_READ_INTERLACE    \
@@ -2402,7 +2403,7 @@
 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
 
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.2.4beta1 - May 25, 2002 (header)\n"
+   " libpng version 1.2.4beta2 - June 20, 2002 (header)\n"
 
 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 /* With these routines we avoid an integer divide, which will be slower on
@@ -2636,6 +2637,7 @@
  * (old interface - DEPRECATED - use png_create_read_struct instead).
  */
 extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
+#undef png_read_init
 #define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
     PNG_LIBPNG_VER_STRING,  sizeof(png_struct));
 extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
@@ -2648,6 +2650,7 @@
  * (old interface - DEPRECATED - use png_create_write_struct instead).
  */
 extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
+#undef png_write_init
 #define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
     PNG_LIBPNG_VER_STRING, sizeof(png_struct));
 extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
diff --git a/pngasmrd.h b/pngasmrd.h
index b1042f9..51d8dc5 100644
--- a/pngasmrd.h
+++ b/pngasmrd.h
@@ -1,6 +1,6 @@
 /* pngasmrd.h - assembler version of utilities to read a PNG file
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 2002 Glenn Randers-Pehrson
  *
diff --git a/pngconf.h b/pngconf.h
index c356eea..9e0322b 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,6 +1,6 @@
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1185,8 +1185,7 @@
 
 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
     (( defined(_Windows) || defined(_WINDOWS) || \
-       defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
-	  ))
+       defined(WIN32) || defined(_WIN32) || defined(__WIN32__) ))
 
 #  if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
 #    define PNGAPI __cdecl
@@ -1213,8 +1212,8 @@
 #           if defined(PNG_BUILD_DLL)
 #              define PNG_IMPEXP __export
 #           else
-#              define PNG_IMPEXP /*__import*/ /* doesn't exist AFAIK in
-                                                 VC++*/
+#              define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
+                                                 VC++ */
 #           endif                             /* Exists in Borland C++ for
                                                  C++ classes (== huge) */
 #        endif
diff --git a/pngerror.c b/pngerror.c
index cca68f1..931a69f 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pnggccrd.c b/pnggccrd.c
index 685f5e2..b65cf99 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -6,7 +6,7 @@
  *     and http://www.intel.com/drg/pentiumII/appnotes/923/923.htm
  *     for Intel's performance analysis of the MMX vs. non-MMX code.
  *
- * libpng version 1.2.4beta1 - May 25, 2002
+ * libpng version 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
@@ -338,7 +338,7 @@
 static png_uint_32  _FullLength;
 static png_uint_32  _MMXLength;
 static int          _dif;
-static int          _patemp;	// temp variables for Paeth routine
+static int          _patemp; // temp variables for Paeth routine
 static int          _pbtemp;
 static int          _pctemp;
 #endif
@@ -386,9 +386,9 @@
 #if defined(PNG_HAVE_ASSEMBLER_COMBINE_ROW)
 
 #define BPP2  2
-#define BPP3  3		/* bytes per pixel (a.k.a. pixel_bytes) */
+#define BPP3  3 /* bytes per pixel (a.k.a. pixel_bytes) */
 #define BPP4  4
-#define BPP6  6		/* (defined only to help avoid cut-and-paste errors) */
+#define BPP6  6 /* (defined only to help avoid cut-and-paste errors) */
 #define BPP8  8
 
 /* Combines the row recently read in with the previous row.
@@ -4825,7 +4825,7 @@
       }
       break;
 
-      default:                // bpp greater than 8 bytes	GRR BOGUS
+      default:                // bpp greater than 8 bytes   GRR BOGUS
       {
          __asm__ __volatile__ (
             "movl _dif, %%edx             \n\t"
diff --git a/pngget.c b/pngget.c
index 4e41ddc..1e6b0fc 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -837,7 +837,7 @@
 
 #ifndef PNG_1_0_X
 #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
-/* this function was added to libpng 1.2.0 and should exist by default*/
+/* this function was added to libpng 1.2.0 and should exist by default */
 png_uint_32 PNGAPI
 png_get_asm_flags (png_structp png_ptr)
 {
diff --git a/pngmem.c b/pngmem.c
index 2341bb6..5c6733f 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -306,7 +306,7 @@
 
 /* Allocate memory for a png_struct or a png_info.  The malloc and
    memset can be replaced by a single call to calloc() if this is thought
-   to improve performance noticably.*/
+   to improve performance noticably. */
 png_voidp /* PRIVATE */
 png_create_struct(int type)
 {
@@ -316,7 +316,7 @@
 
 /* Allocate memory for a png_struct or a png_info.  The malloc and
    memset can be replaced by a single call to calloc() if this is thought
-   to improve performance noticably.*/
+   to improve performance noticably. */
 png_voidp /* PRIVATE */
 png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
 {
diff --git a/pngpread.c b/pngpread.c
index 897fc32..78d75d1 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -221,7 +221,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
    }
    else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4))
@@ -231,7 +230,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
    }
    else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4))
@@ -243,7 +241,7 @@
      if (!(png_ptr->mode & PNG_HAVE_IHDR))
        png_error(png_ptr, "Missing IHDR before IDAT");
      else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
-	      !(png_ptr->mode & PNG_HAVE_PLTE))
+         !(png_ptr->mode & PNG_HAVE_PLTE))
        png_error(png_ptr, "Missing PLTE before IDAT");
 
       if (png_ptr->mode & PNG_HAVE_IDAT)
@@ -270,8 +268,8 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
+
       png_ptr->process_mode = PNG_READ_DONE_MODE;
       png_push_have_end(png_ptr, info_ptr);
    }
@@ -283,7 +281,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -295,7 +292,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -307,7 +303,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -319,7 +314,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -331,7 +325,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -343,7 +336,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -355,7 +347,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -367,7 +358,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -379,7 +369,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -391,7 +380,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -403,7 +391,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -415,7 +402,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -427,7 +413,6 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
@@ -439,30 +424,49 @@
          png_push_save_buffer(png_ptr);
          return;
       }
-
       png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
 #if defined(PNG_READ_tEXt_SUPPORTED)
    else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
    {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
       png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
 #if defined(PNG_READ_zTXt_SUPPORTED)
    else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
    {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
       png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
 #if defined(PNG_READ_iTXt_SUPPORTED)
    else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
    {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
       png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
    }
 #endif
    else
    {
+      if (png_ptr->push_length + 4 > png_ptr->buffer_size)
+      {
+         png_push_save_buffer(png_ptr);
+         return;
+      }
       png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
    }
 
@@ -802,13 +806,13 @@
                   png_read_push_finish_row(png_ptr);
                }
             }
-	    if (png_ptr->pass == 4 && png_ptr->height <= 4)
-	    {
-	        for (i = 0; i < 2 && png_ptr->pass == 4; i++)
-                {
-                   png_push_have_row(png_ptr, png_bytep_NULL);
-                   png_read_push_finish_row(png_ptr);
-                }
+            if (png_ptr->pass == 4 && png_ptr->height <= 4)
+            {
+               for (i = 0; i < 2 && png_ptr->pass == 4; i++)
+               {
+                  png_push_have_row(png_ptr, png_bytep_NULL);
+                  png_read_push_finish_row(png_ptr);
+               }
             }
             if (png_ptr->pass == 6 && png_ptr->height <= 4)
             {
@@ -1067,7 +1071,6 @@
 #endif
 
       key = png_ptr->current_text;
-      png_ptr->current_text = 0;
 
       for (text = key; *text; text++)
          /* empty loop */ ;
@@ -1088,6 +1091,7 @@
 
       png_free(png_ptr, key);
       png_free(png_ptr, text_ptr);
+      png_ptr->current_text = NULL;
 
       if (ret)
         png_warning(png_ptr, "Insufficient memory to store text chunk.");
@@ -1161,7 +1165,6 @@
       png_push_crc_finish(png_ptr);
 
       key = png_ptr->current_text;
-      png_ptr->current_text = 0;
 
       for (text = key; *text; text++)
          /* empty loop */ ;
@@ -1169,6 +1172,7 @@
       /* zTXt can't have zero text */
       if (text == key + png_ptr->current_text_size)
       {
+         png_ptr->current_text = NULL;
          png_free(png_ptr, key);
          return;
       }
@@ -1177,6 +1181,7 @@
 
       if (*text != PNG_TEXT_COMPRESSION_zTXt) /* check compression byte */
       {
+         png_ptr->current_text = NULL;
          png_free(png_ptr, key);
          return;
       }
@@ -1201,6 +1206,7 @@
          {
             inflateReset(&png_ptr->zstream);
             png_ptr->zstream.avail_in = 0;
+            png_ptr->current_text = NULL;
             png_free(png_ptr, key);
             png_free(png_ptr, text);
             return;
@@ -1254,11 +1260,13 @@
 
       if (ret != Z_STREAM_END)
       {
+         png_ptr->current_text = NULL;
          png_free(png_ptr, key);
          png_free(png_ptr, text);
          return;
       }
 
+      png_ptr->current_text = NULL;
       png_free(png_ptr, key);
       key = text;
       text += key_size;
@@ -1355,7 +1363,6 @@
 #endif
 
       key = png_ptr->current_text;
-      png_ptr->current_text = 0;
 
       for (lang = key; *lang; lang++)
          /* empty loop */ ;
@@ -1387,6 +1394,8 @@
 
       ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
 
+      png_ptr->current_text = NULL;
+
       png_free(png_ptr, text_ptr);
       if (ret)
         png_warning(png_ptr, "Insufficient memory to store iTXt chunk.");
diff --git a/pngread.c b/pngread.c
index 1a9e711..08e7bfc 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -70,8 +70,7 @@
       png_ptr->zbuf=NULL;
 #ifdef PNG_USER_MEM_SUPPORTED
       png_destroy_struct_2((png_voidp)png_ptr, 
-			   (png_free_ptr)free_fn,
-			   (png_voidp)mem_ptr);
+         (png_free_ptr)free_fn, (png_voidp)mem_ptr);
 #else
       png_destroy_struct((png_voidp)png_ptr);
 #endif
@@ -175,7 +174,6 @@
    png_read_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
 }
 
-#undef png_read_init_2
 void PNGAPI
 png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
    png_size_t png_struct_size, png_size_t png_info_size)
@@ -795,7 +793,7 @@
  * not called png_set_interlace_handling(), the display_row buffer will
  * be ignored, so pass NULL to it.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.4beta1
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.4beta2
  */
 
 void PNGAPI
@@ -844,7 +842,7 @@
  * only call this function once.  If you desire to have an image for
  * each pass of a interlaced image, use png_read_rows() instead.
  *
- * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.4beta1
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.4beta2
  */
 void PNGAPI
 png_read_image(png_structp png_ptr, png_bytepp image)
@@ -1250,6 +1248,12 @@
    png_free(png_ptr, png_ptr->save_buffer);
 #endif
 
+#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
+#ifdef PNG_TEXT_SUPPORTED
+   png_free(png_ptr, png_ptr->current_text);
+#endif /* PNG_TEXT_SUPPORTED */
+#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
+
    /* Save the important info out of the png_struct, in case it is
     * being used again.
     */
diff --git a/pngrio.c b/pngrio.c
index 7a358c9..ff99ae1 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngrtran.c b/pngrtran.c
index a04f306..f0cc8bd 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
 
 /* pngrtran.c - transforms the data in a row for PNG readers
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -879,7 +879,7 @@
                }
             }
          }
-         /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN)*/
+         /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
          else
          /* color_type != PNG_COLOR_TYPE_PALETTE */
          {
diff --git a/pngrutil.c b/pngrutil.c
index fbcb64d..757ce7a 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1215,7 +1215,7 @@
 void /* PRIVATE */
 png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
 {
-   png_byte	readbuf[PNG_MAX_PALETTE_LENGTH];
+   png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
 
    png_debug(1, "in png_handle_tRNS\n");
 
@@ -1398,7 +1398,7 @@
 png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
 {
    int num, i;
-   png_uint_16	readbuf[PNG_MAX_PALETTE_LENGTH];
+   png_uint_16 readbuf[PNG_MAX_PALETTE_LENGTH];
 
    png_debug(1, "in png_handle_hIST\n");
 
diff --git a/pngset.c b/pngset.c
index 22d3aac..a6c3ccf 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -200,7 +200,7 @@
 void PNGAPI
 png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
 {
-   int	i;
+   int i;
 
    png_debug1(1, "in %s storage function\n", "hIST");
    if (png_ptr == NULL || info_ptr == NULL)
@@ -846,10 +846,10 @@
    if (trans != NULL)
    {
        /*
-	* It may not actually be necessary to set png_ptr->trans here;
-	* we do it for backward compatibility with the way the png_handle_tRNS
-	* function used to do the allocation.
-	*/
+        * It may not actually be necessary to set png_ptr->trans here;
+        * we do it for backward compatibility with the way the png_handle_tRNS
+        * function used to do the allocation.
+        */
 #ifdef PNG_FREE_ME_SUPPORTED
        png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
 #endif
@@ -1141,8 +1141,8 @@
      * so first zero them out of the master copy, then logical-OR in the
      * allowed subset that was requested */
 
-    png_ptr->asm_flags &= ~settable_asm_flags;			/* zero them */
-    png_ptr->asm_flags |= (asm_flags & settable_asm_flags);	/* set them */
+    png_ptr->asm_flags &= ~settable_asm_flags;               /* zero them */
+    png_ptr->asm_flags |= (asm_flags & settable_asm_flags);  /* set them */
 }
 #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
 
diff --git a/pngtest.c b/pngtest.c
index 48b0c3e..3e90d14 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -64,7 +64,7 @@
 #endif
 
 #if !PNG_DEBUG
-#  define SINGLE_ROWBUF_ALLOC	/* makes buffer overruns easier to nail */
+#  define SINGLE_ROWBUF_ALLOC  /* makes buffer overruns easier to nail */
 #endif
 
 /* Turn on CPU timing
@@ -1512,4 +1512,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_4beta1 your_png_h_is_not_version_1_2_4beta1;
+typedef version_1_2_4beta2 your_png_h_is_not_version_1_2_4beta2;
diff --git a/pngtrans.c b/pngtrans.c
index c127959..590bb46 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
 
 /* pngtrans.c - transforms the data in a row (used by both readers and writers)
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngvcrd.c b/pngvcrd.c
index 0bbdb87..d4cf54c 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,7 +2,7 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng version 1.2.4beta1 - May 25, 2002
+ * libpng version 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * Copyright (c) 1998, Intel Corporation
diff --git a/pngwio.c b/pngwio.c
index 96047d2..11c64c9 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwrite.c b/pngwrite.c
index 17c048f..49da346 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -555,7 +555,6 @@
    png_write_init_2(png_ptr, "1.0.6 or earlier", 0, 0);
 }
 
-#undef png_write_init_2
 void PNGAPI
 png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
    png_size_t png_struct_size, png_size_t png_info_size)
diff --git a/pngwtran.c b/pngwtran.c
index 0c1ab2a..62ccd00 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,7 +1,7 @@
 
 /* pngwtran.c - transforms the data in a row for PNG writers
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngwutil.c b/pngwutil.c
index a5f44ed..aa9de13 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.2.4beta1 - May 25, 2002
+ * libpng 1.2.4beta2 - June 20, 2002
  * For conditions of distribution and use, see copyright notice in png.h
  * Copyright (c) 1998-2002 Glenn Randers-Pehrson
  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/projects/msvc/README.txt b/projects/msvc/README.txt
index 09e67ba..b26cb60 100644
--- a/projects/msvc/README.txt
+++ b/projects/msvc/README.txt
@@ -1,5 +1,5 @@
 Microsoft Developer Studio Build File, Format Version 6.00 for
-libpng 1.2.4beta1 (May 25, 2002) and zlib
+libpng 1.2.4beta2 (June 20, 2002) and zlib
 
 Copyright (C) 2000 Simon-Pierre Cadieux
 For conditions of distribution and use, see copyright notice in png.h
@@ -29,13 +29,13 @@
 This project will build the PNG Development Group's "official" versions of
 libpng and zlib libraries:
 
-   libpng12.dll          (default version, currently C code only)
-   libpng12a.dll         (C + Assembler version)
-   libpng12b.dll         (C + Assembler debug version)
-   libpng12d.dll         (C code debug version)
-   libpng12vb.dll       (version for VB, uses "stdcall" protocol)
-   libpng12[c,e-m].dll   (reserved for official versions) 
-   libpng12[n-z].dll     (available for private versions)
+   libpng13.dll          (default version, currently C code only)
+   libpng13a.dll         (C + Assembler version)
+   libpng13b.dll         (C + Assembler debug version)
+   libpng13d.dll         (C code debug version)
+   libpng13vb.dll       (version for VB, uses "stdcall" protocol)
+   libpng13[c,e-m].dll   (reserved for official versions) 
+   libpng13[n-z].dll     (available for private versions)
    zlib.dll             (default version, currently C code only)
    zlibd.dll            (debug version)
    zlibvb.dll           (version for Visual Basic, uses "stdcall" protocol)
diff --git a/projects/msvc/libpng.dsp b/projects/msvc/libpng.dsp
index 858c6d2..d08d3d5 100644
--- a/projects/msvc/libpng.dsp
+++ b/projects/msvc/libpng.dsp
@@ -57,7 +57,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /dll /machine:I386
-# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng12.dll"
+# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng13.dll"
 # SUBTRACT LINK32 /pdb:none
 
 !ELSEIF  "$(CFG)" == "libpng - Win32 DLL Debug"
@@ -85,7 +85,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng12d.dll"
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbg\libpng13d.dll"
 
 !ELSEIF  "$(CFG)" == "libpng - Win32 DLL ASM"
 
@@ -112,7 +112,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /dll /machine:I386
-# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng12a.dll"
+# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_asm\libpng13a.dll"
 # SUBTRACT LINK32 /pdb:none
 
 !ELSEIF  "$(CFG)" == "libpng - Win32 DLL Debug ASM"
@@ -140,7 +140,7 @@
 # ADD BSC32 /nologo
 LINK32=link.exe
 # ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
-# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng12b.dll"
+# ADD LINK32 /nologo /dll /debug /machine:I386 /out:".\win32\libpng\dll_dbga\libpng13b.dll"
 
 !ELSEIF  "$(CFG)" == "libpng - Win32 LIB"
 
@@ -219,9 +219,9 @@
 # ADD BASE BSC32 /nologo
 # ADD BSC32 /nologo
 LINK32=link.exe
-# ADD BASE LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng12.dll"
+# ADD BASE LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll\libpng13.dll"
 # SUBTRACT BASE LINK32 /pdb:none
-# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_vb\libpngvb12.dll"
+# ADD LINK32 /nologo /dll /machine:I386 /out:".\win32\libpng\dll_vb\libpngvb13.dll"
 # SUBTRACT LINK32 /pdb:none
 
 !ENDIF 
diff --git a/projects/msvc/png32ms.def b/projects/msvc/png32ms.def
index d7f754f..d29729e 100644
--- a/projects/msvc/png32ms.def
+++ b/projects/msvc/png32ms.def
@@ -6,7 +6,7 @@
 DESCRIPTION "PNG image compression library for Windows"
 
 EXPORTS
-;Version 1.2.4beta1
+;Version 1.2.4beta2
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
diff --git a/projects/netware.txt b/projects/netware.txt
index 87cb249..38cc672 100644
--- a/projects/netware.txt
+++ b/projects/netware.txt
@@ -1,6 +1,6 @@
 A set of project files is available for Netware.  Get
-libpng-1.2.4beta1-project-netware.zip from a libpng distribution
+libpng-1.2.4beta2-project-netware.zip from a libpng distribution
 site such as http://libpng.sourceforge.net
 
 Put the zip file in this directory (projects) and then run
-"unzip -a libpng-1.2.4beta1-project-netware.zip"
+"unzip -a libpng-1.2.4beta2-project-netware.zip"
diff --git a/projects/wince.txt b/projects/wince.txt
index 8819ffb..e6c518d 100644
--- a/projects/wince.txt
+++ b/projects/wince.txt
@@ -1,6 +1,6 @@
 A set of project files is available for WinCE.  Get
-libpng-1.2.4beta1-project-wince.zip from a libpng distribution
+libpng-1.2.4beta2-project-wince.zip from a libpng distribution
 site such as http://libpng.sourceforge.net
 
 Put the zip file in this directory (projects) and then run
-"unzip -a libpng-1.2.4beta1-project-wince.zip"
+"unzip -a libpng-1.2.4beta2-project-wince.zip"
diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in
index ca91b49..5f54a4f 100755
--- a/scripts/libpng-config-head.in
+++ b/scripts/libpng-config-head.in
@@ -8,7 +8,7 @@
 
 # Modeled after libxml-config.
 
-version=1.2.4beta1
+version=1.2.4beta2
 prefix=""
 cppflags=""
 cflags=""
diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in
index 84044dc..fc811d5 100644
--- a/scripts/libpng.pc.in
+++ b/scripts/libpng.pc.in
@@ -6,6 +6,6 @@
 
 Name: libpng12
 Description: Loads and saves PNG files
-Version: 1.2.4beta1
+Version: 1.2.4beta2
 Libs: -L${libdir} -lpng12 -lz -lm
 Cflags: -I${includedir}/libpng12
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index 492f65e..44a150a 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -33,7 +33,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index e20b958..e85c02b 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -33,7 +33,7 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index 519a552..00711cb 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -17,7 +17,7 @@
 RM = rm -f
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 prefix=/usr/local
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 8c3bf8b..9ec5aae 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -12,7 +12,7 @@
 ZLIBINC=/usr/local/include
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 ALIGN=
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index d82cef2..67694c0 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -78,8 +78,8 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGDLL = 12
-PNGMIN = 1.2.4beta1
+PNGDLL = 13
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 SHAREDLIB=cygpng$(PNGDLL).dll
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index 9e01643..c55f817 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -23,7 +23,7 @@
 RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 58ce427..c3694a1 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -32,7 +32,7 @@
 ZLIBINC=../zlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -73,7 +73,8 @@
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJS)
-	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB) -lz -lm
+	$(CC) -shared -o $@ $(OBJS) -L$(ZLIBLIB)
+	-soname $(LIBNAME).so.$(PNGMAJ) -lz -lm
 
 pngtest: pngtest.o libpng.a
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index 0cf818a..e9ea46a 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -15,16 +15,17 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
 
-# where "make install" puts libpng.a, libpng12/libpng12.so*,
-# $(LIBNAME)/png.h and $(LIBNAME)/pngconf.h
+# where "make install" puts libpng12.a, libpng12.so*,
+# libpng12/png.h and libpng12/pngconf.h
+# Prefix must be a full pathname.
 prefix=/usr/local
 
-# Where the zlib library and include files are located
+# Where the zlib library and include files are located.
 #ZLIBLIB=/usr/local/lib
 #ZLIBINC=/usr/local/include
 ZLIBLIB=../zlib
@@ -93,6 +94,10 @@
 
 all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
 
+libpng.a: $(OBJS)
+	ar rc $@ $(OBJS)
+	$(RANLIB) $@
+
 libpng.pc:
 	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
@@ -102,7 +107,7 @@
 	echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_THREAD_UNSAFE_OK \
 	   -DPNG_USE_PNGGCCRD\"; \
 	echo cflags=\"\"; \
-	echo ldflags=\"\"; \
+	echo ldflags=\"-L$(LIBPATH) -Wl,-rpath,$(LIBPATH)\"; \
 	echo libs=\"-lpng12 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
@@ -113,10 +118,6 @@
 pnggccrd.pic.o:	pnggccrd.c png.h pngconf.h
 	$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
 
-libpng.a: $(OBJS)
-	ar rc $@ $(OBJS)
-	$(RANLIB) $@
-
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -124,8 +125,9 @@
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
-	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
-	 $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
+	$(CC) -shared -Wl,-soname,$(LIBNAME).so.$(PNGMAJ) \
+	-o $(LIBNAME).so.$(PNGVER) \
+	$(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
 
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
@@ -201,9 +203,16 @@
 
 install: install-static install-shared install-man install-config
 
+test-installed:
+	$(CC) -I$(ZLIBINC) \
+	   `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
+	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB)
+	pngtesti pngtest.png
+
 clean:
-	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
-	pngtest pngout.png
+	/bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
+	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index 93b2d2c..218cb04 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -33,7 +33,7 @@
 #RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index eeb497f..63cf2f7 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -17,7 +17,7 @@
 RANLIB=ranlib
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index d101583..8e24221 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -5,16 +5,17 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
 
-# where "make install" puts libpng12.a, libpng12/libpng12.so*,
+# where "make install" puts libpng12.a, libpng12.so*,
 # libpng12/png.h and libpng12/pngconf.h
+# Prefix must be a full pathname.
 prefix=/usr/local
 
-# Where the zlib library and include files are located
+# Where the zlib library and include files are located.
 #ZLIBLIB=/usr/local/lib
 #ZLIBINC=/usr/local/include
 ZLIBLIB=../zlib
@@ -70,7 +71,7 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
+all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc libpng-config
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
@@ -108,7 +109,7 @@
 
 test: pngtest pngtest-static
 	@echo ""
-	@echo "   Running pngtest dynamically linked with libpng12.so:"
+	@echo "   Running pngtest dynamically linked with $(LIBNAME).so:"
 	@echo ""
 	./pngtest
 	@echo ""
@@ -174,9 +175,16 @@
 
 install: install-static install-shared install-man install-config
 
+test-installed:
+	$(CC) -I$(ZLIBINC) \
+	   `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
+	   -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB)
+	pngtesti pngtest.png
+
 clean:
-	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNMAJ)* \
-	pngtest pngout.png
+	/bin/rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
+	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.macosx b/scripts/makefile.macosx
index 76fc57c..5aec5e0 100644
--- a/scripts/makefile.macosx
+++ b/scripts/makefile.macosx
@@ -17,7 +17,7 @@
 CC=cc
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index 9321bdd..9a9ca1d 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -13,7 +13,7 @@
 
 LIB=	png12
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.4beta1
+SHLIB_MINOR=	1.2.4beta2
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd
index dcd6cf7..40b022b 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -13,7 +13,7 @@
 
 LIB=	png
 SHLIB_MAJOR=	3
-SHLIB_MINOR=	1.2.4beta1
+SHLIB_MINOR=	1.2.4beta2
 SRCS=	pnggccrd.c png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
 		pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
 		pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd
index 5d11ab1..cfc89fe 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -7,7 +7,7 @@
 MANDIR= ${PREFIX}/man/cat
 
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.4beta1
+SHLIB_MINOR=	1.2.4beta2
 
 LIB=	png
 SRCS=	png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index 5288a70..77031ed 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -24,7 +24,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index b71f9ae..7745e18 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -1,36 +1,43 @@
-# makefile for libpng, SGI IRIX with gcc
-# Copyright (C) 2002 Glenn Randers-Pehrson
+# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
+# Copyright (C) 2001-2002 Glenn Randers-Pehrson
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-# where make install puts libpng.a and png.h
+# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
+# Prefix must be a full pathname.
+
 prefix=/usr/local
 
 # Where the zlib library and include files are located
-ZLIBLIB=/usr/local/lib32
-ZLIBINC=/usr/local/include
-#ZLIBLIB=../zlib
-#ZLIBINC=../zlib
+#ZLIBLIB=/usr/local/lib32
+#ZLIBINC=/usr/local/include
+#ZLIBLIB=/usr/local/lib
+#ZLIBINC=/usr/local/include
+ZLIBLIB=../zlib
+ZLIBINC=../zlib
+
+LIBNAME=libpng12
+PNGMAJ = 0
+PNGMIN = 1.2.4beta2
+PNGVER = $(PNGMAJ).$(PNGMIN)
+CC=gcc
 
 # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
 # See "man abi".  zlib must be built with the same ABI.
 ABI=
 
-CC=gcc
-
 WARNMORE= # -g -DPNG_DEBUG=5
 CFLAGS=$(ABI) -I$(ZLIBINC) -O2 $(WARNMORE) -fPIC -mabi=n32
 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
-LDSHARED=CC $(ABI) -shared
+LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
 # See "man dso" for info about shared objects
 
-LIBNAME=libpng12
-PNGMAJ = 0
-PNGMIN = 1.2.4beta1
-PNGVER = $(PNGMAJ).$(PNGMIN)
-LIBS=$(LIBNAME).so.$(PNGVER)
+RANLIB=echo
+#RANLIB=ranlib
+
 INCPATH=$(prefix)/include
-LIBPATH=$(prefix)/lib32
+LIBPATH=$(prefix)/lib
+#LIBPATH=$(prefix)/lib32
 MANPATH=$(prefix)/man
 BINPATH=$(prefix)/bin
 
@@ -49,21 +56,21 @@
 DL=$(DESTDIR)$(LIBPATH)
 DM=$(DESTDIR)$(MANPATH)
 
-RANLIB=echo
-#RANLIB=ranlib
-
-OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
+OBJS = pnggccrd.o png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
 
-all: libpng.a $(LIBNAME).so.$(PNGVER) pngtest libpng.pc libpng-config
+all: libpng.a pngtest shared libpng.pc libpng-config
 
 libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
+	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+shared: $(LIBNAME).so.$(PNGVER)
+
 libpng.pc:
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > \
+	libpng.pc
 
 libpng-config:
 	( cat scripts/libpng-config-head.in; \
@@ -71,24 +78,29 @@
 	echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
 		-DPNG_NO_ASSEMBLER_CODE\"; \
 	echo cflags=\"$(ABI)\"; \
-	echo ldflags=\"-L$(LIBPATH)\"; \
+	echo ldflags=\"-L$(LIBPATH) -rpath $(LIBPATH) \"; \
 	echo libs=\"-lpng12 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
 
+$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
+	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+
+$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
+	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
+
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
 	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
-	ln -s -f $@ $(LIBNAME).so
-	ln -s -f $@ $(LIBNAME).so.$(PNGMAJ)
 
 pngtest: pngtest.o libpng.a
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 
 test: pngtest
+	echo
+	echo Testing local static library.
 	./pngtest
 
-
 install-headers: png.h pngconf.h
 	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
@@ -147,8 +159,25 @@
 
 install: install-static install-shared install-man install-config
 
+# If you installed in $(DESTDIR), test-installed won't work until you
+# move the library to its final location.
+
+test-installed:
+	$(CC) -I$(ZLIBINC) \
+	   `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
+	   -L$(ZLIBLIB) -rpath $(ZLIBLIB)
+	echo
+	echo Testing installed dynamic shared library.
+	pngtesti pngtest.png
+
 clean:
-	rm -f *.o libpng.a pngtest pngout.png
+	rm -f *.o libpng.a pngtest pngout.png libpng.pc libpng-config \
+	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
+
+DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
+writelock:
+	chmod a-w *.[ch35] $(DOCS) scripts/*
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
@@ -168,4 +197,5 @@
 pngwtran.o: png.h pngconf.h
 pngwutil.o: png.h pngconf.h
 pngpread.o: png.h pngconf.h
+pnggccrd.o: png.h pngconf.h
 
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index 9098fe1..0380d69 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -3,7 +3,14 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
-# where make install puts libpng.a, libpng12.so and libpng12/png.h
+LIBNAME=libpng12
+PNGMAJ = 0
+PNGMIN = 1.2.4beta2
+PNGVER = $(PNGMAJ).$(PNGMIN)
+
+# Where make install puts libpng.a, libpng12.so, and libpng12/png.h
+# Prefix must be a full pathname.
+
 prefix=/usr/local
 
 # Where the zlib library and include files are located
@@ -26,14 +33,9 @@
 CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
 LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng12 -lz -lm
 LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
-LDSHARED=cc $(ABI) -shared
+LDSHARED=cc $(ABI) -shared -soname $(LIBNAME).so.$(PNGMAJ)
 # See "man dso" for info about shared objects
 
-LIBNAME=libpng12
-PNGMAJ = 0
-PNGMIN = 1.2.4beta1
-PNGVER = $(PNGMAJ).$(PNGMIN)
-
 RANLIB=echo
 #RANLIB=ranlib
 
@@ -42,7 +44,6 @@
 #LIBPATH=$(prefix)/lib32
 MANPATH=$(prefix)/man
 BINPATH=$(prefix)/bin
-BINPATH=$(prefix)/bin
 
 # override DESTDIR= on the make install command line to easily support
 # installing into a temporary location.  Example:
@@ -65,6 +66,10 @@
 
 all: libpng.a pngtest shared libpng.pc libpng-config
 
+libpng.a: $(OBJS)
+	ar rc $@ $(OBJS)
+	$(RANLIB) $@
+
 shared: $(LIBNAME).so.$(PNGVER)
 
 libpng.pc:
@@ -76,33 +81,34 @@
 	echo cppflags=\"-I$(INCPATH)/$(LIBNAME) -DPNG_USE_PNGGCCRD \
 		-DPNG_NO_ASSEMBLER_CODE\"; \
 	echo cflags=\"$(ABI)\"; \
-	echo ldflags=\"-L$(LIBPATH)\"; \
+	echo ldflags=\"-L$(LIBPATH) -rpath $(LIBPATH) \"; \
 	echo libs=\"-lpng12 -lz -lm\"; \
 	cat scripts/libpng-config-body.in ) > libpng-config
 	chmod +x libpng-config
 
-libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
-	$(RANLIB) $@
+$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
+	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
+
+$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
+	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
 
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
 	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
-	ln -s -f $@ $(LIBNAME).so
-	ln -s -f $@ $(LIBNAME).so.$(PNGMAJ)
 
 pngtest: pngtest.o libpng.a
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 
 test: pngtest
+	echo
+	echo Testing local static library.
 	./pngtest
 
 install-headers: png.h pngconf.h
 	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
 	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
 	cp png.h pngconf.h $(DI)/$(LIBNAME)
-	chmod 644 $(DI)/$(LIBNAME)/png.h \
-	$(DI)/$(LIBNAME)/pngconf.h
+	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
 	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
 	-@/bin/rm -f $(DI)/libpng
 	(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
@@ -156,9 +162,21 @@
 
 install: install-static install-shared install-man install-config
 
+# If you installed in $(DESTDIR), test-installed won't work until you
+# move the library to its final location.
+
+test-installed:
+	echo
+	echo Testing installed dynamic shared library.
+	$(CC) -I$(ZLIBINC) \
+	   `$(BINPATH)/libpng12-config --cppflags --cflags` pngtest.c \
+	   -o pngtesti `$(BINPATH)/libpng12-config --ldflags --libs` \
+	   -L$(ZLIBLIB) -rpath $(ZLIBLIB)
+	pngtesti pngtest.png
+
 clean:
-	rm -f *.o libpng.a pngtest pngout.png $(LIBNAME).so \
-	$(LIBNAME).so.$(PNGMAJ)*
+	rm -f *.o libpng.a pngtest pngtesti pngout.png libpng.pc libpng-config \
+	$(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* so_locations
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index a23e0fa..81b0bca 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -34,7 +34,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -123,14 +123,14 @@
 	chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
 	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
 	-@/bin/rm -f $(DI)/libpng
-	(cd $(DI); ln -f -s $(LIBNAME) libpng)
+	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
 	cp libpng.a $(DL)/$(LIBNAME).a
 	chmod 644 $(DL)/$(LIBNAME).a
 	-@/bin/rm -f $(DL)/libpng.a
-	(cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
+	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
 	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 61debd2..ccdc3c7 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -30,7 +30,7 @@
 RANLIB=echo
 
 PNGMAJ = 0
-PNGMIN = 1.2.4beta1
+PNGMIN = 1.2.4beta2
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index 5589463..56d3d0b 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -7,7 +7,7 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.2.4beta1';
+  PNG_LIBPNG_VER_STRING = '1.2.4beta2';
   PNG_LIBPNG_VER        =  10204;
 
 type
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index 72d1d0b..7dadb6c 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
 ; PNG.LIB module definition file for OS/2
 ;----------------------------------------
 
-; Version 1.2.4beta1
+; Version 1.2.4beta2
 
 LIBRARY		PNG
 DESCRIPTION	"PNG image compression library for OS/2"