Imported from libpng-1.2.3rc1.tar
diff --git a/ANNOUNCE b/ANNOUNCE
index 70f7a48..6fdb4ab 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,49 +1,30 @@
 
-Libpng 1.2.2 - April 15, 2002
+Libpng 1.2.3rc1 - April 27, 2002
 
-This is a public release of libpng, intended for use in production codes.
+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.1):
+Changes since the last public release (1.2.2):
 
-  Fixed a bug with reading the length of iCCP profiles (Larry Reeves).
-  Revised makefile.linux, makefile.gcmmx, and others to generate
-    libpng.a, libpngNN.so, libpng.so.NN, and libpngNN/png.h
-  Revised makefile.darwin to remove "-undefined suppress" option.
-  Added checks for gamma and chromaticity values over 21474.83, which exceed
-    the limit for PNG unsigned 32-bit integers when encoded.
-  Revised calls to png_create_read_struct() and png_create_write_struct()
-    for simpler debugging.
-  Revised png_zalloc() so zlib handles errors (uses PNG_FLAG_MALLOC_NULL_MEM_OK)
-  Check chunk_length and idat_size for invalid (over PNG_MAX_UINT) lengths.
-  Check for invalid image dimensions in png_get_IHDR.
-  Added install-shared and install-static targets to all makefiles that make
-    shared libraries.
-  Always do gamma compensation when image is partially transparent.
-  Modified shared-library makefiles to install pkgconfig/libpngNN.pc.
-  Export (with PNGAPI) png_zalloc, png_zfree, and png_handle_as_unknown
-  Removed unused png_write_destroy_info prototype from png.h
-  Eliminated incorrect use of width_mmx from pnggccrd.c in pixel_bytes == 8 case
-  Stopped a double free of palette, hist, and trans when not using free_me.
-  Added makefile.32sunu for Sun Ultra 32 and makefile.64sunu for Sun Ultra 64.
-  Compute background.gray and background_1.gray even when color_type is RGB
-    in case image gets reduced to gray later (Jason Summers).
-  Added PNG_1_0_X macro which can be used to build a 1.0.x-compatible library.
-  Added missing PNGAPI to several function definitions.
-  Check for invalid bit_depth or color_type in png_get_IHDR(), and
-    check for missing PLTE or IHDR in png_push_read_chunk() (Matthias Clasen).
-  Revised iTXt support to accept NULL for lang and lang_key.
-  Compute gamma for color components of background even when color_type is gray.
-  Revised makefiles to put png.h and pngconf.h only in $prefix/include/libpngNN
-  Revised makefiles to make symlink to libpng.so.NN in addition to libpngNN.so
-  Prevent png_zalloc() from trying to memset memory that it failed to acquire.
-  Add typecasts of PNG_MAX_UINT in pngset_cHRM_fixed() (Matt Holgate).
-  Ensure that the right function (user or default) is used to free the
-    png_struct after an error in png_create_read_struct_2().
-  Save the ebx register in pnggccrd.c (Sami Farin)
-  Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
-  Updated makefiles to put headers in include/libpng and remove old include/*.h.
-  Revised description of png_set_filter() in libpng.3/libpng.txt.
-  Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
+version 1.2.2patch03 [April 18, 2002]
+  Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc
+  Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install
+  Added install: target to makefile.32sunu and makefile.64sunu
+  Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng
+    subdirectory to libpngNN subdirectory without the full pathname.
+  Moved generation of libpng.pc from "install" to "all" in 15 makefiles.
+version 1.2.3rc1 [April 27, 2002]
+  Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos).
+  Added $(DESTDIR) feature to 24 makefiles (Tim Mooney)
+  Fixed bug with $prefix, should be $(prefix) in makefile.hpux.
+  Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin
+  Added a link from libpngNN.pc to libpng.pc in 15 makefiles.
+  Added links from include/libpngNN/*.h to include/*.h in 24 makefiles.
+  Revised makefile.darwin to make relative links without full pathname.
+  Added setjmp() at the end of png_create_*_struct_2() in case user forgets
+    to put one in their application.
+  Restored png_zalloc() and png_zfree() prototypes to version 1.2.1 and
+    removed them from module definition files.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/CHANGES b/CHANGES
index caeb378..c963ce9 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1008,7 +1008,6 @@
   Updated various makefiles so "make clean" does not remove previous major
     version of the shared library.
 version 1.2.1rc2 [December 4, 2001]
-  Added a pop/push operation to pngvcrd.c, to preserve Eflag.
   Always allocate 256-entry internal palette, hist, and trans arrays, to
     avoid out-of-bounds memory reference caused by invalid PNG datastreams.
   Added a check for prefix_length > data_length in iCCP chunk handler.
@@ -1066,8 +1065,31 @@
   Add "mem_ptr = png_ptr->mem_ptr" in png_destroy_write_struct() (Paul Gardner).
   Updated makefiles to put headers in include/libpng and remove old include/*.h.
 version 1.2.2 [April 15, 2002]
+version 1.0.13 [April 15, 2002]
   Revised description of png_set_filter() in libpng.3/libpng.txt.
   Revised makefile.netbsd and added makefile.neNNbsd and makefile.freebsd
+version 1.0.13patch01 [April 17, 2002]
+version 1.2.2patch01 [April 17, 2002]
+  Changed ${PNGMAJ}.${PNGVER} bug to ${PNGVER} in makefile.sgi and makefile.sggcc
+  Fixed VER -> PNGVER typo in makefile.macosx and added install-static to install
+  Added install: target to makefile.32sunu and makefile.64sunu
+version 1.0.13patch03 [April 18, 2002]
+version 1.2.2patch03 [April 18, 2002]
+  Revised 15 makefiles to link libpng.a to libpngNN.a and the include libpng
+  subdirectory to libpngNN subdirectory without the full pathname.
+  Moved generation of libpng.pc from "install" to "all" in 15 makefiles.
+version 1.2.3rc1 [April 27, 2002]
+  Added install-man target to 15 makefiles (Dimitri Papadopolous-Orfanos).
+  Added $(DESTDIR) feature to 24 makefiles (Tim Mooney)
+  Fixed bug with $prefix, should be $(prefix) in makefile.hpux.
+  Updated cygwin-specific portion of pngconf.h and revised makefile.cygwin
+  Added a link from libpngNN.pc to libpng.pc in 15 makefiles.
+  Added links from include/libpngNN/*.h to include/*.h in 24 makefiles.
+  Revised makefile.darwin to make relative links without full pathname.
+  Added setjmp() at the end of png_create_*_struct_2() in case user forgets
+    to put one in their application.
+  Restored png_zalloc() and png_zfree() prototypes to version 1.2.1 and
+    removed them from module definition files.
 
 Send comments/corrections/commendations to
 png-implement@ccrc.wustl.edu or to randeg@alum.rpi.edu
diff --git a/INSTALL b/INSTALL
index 788b22c..c9f63d2 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
 
-Installing libpng version 1.2.2 - April 15, 2002
+Installing libpng version 1.2.3rc1 - April 27, 2002
 
 Before installing libpng, you must first install zlib.  zlib
 can usually be found wherever you got libpng.  zlib can be
@@ -10,7 +10,7 @@
 version of zlib that's installed.
 
 You can rename the directories that you downloaded (they
-might be called "libpng-1.2.2" or "lpng109" and "zlib-1.1.3"
+might be called "libpng-1.2.3rc1" or "lpng109" and "zlib-1.1.3"
 or "zlib113") so that you have directories called "zlib" and "libpng".
 
 Your directory structure should look like this:
@@ -64,8 +64,8 @@
 include
 
  makefile.std      =>  Generic UNIX makefile (cc, creates static libpng.a)
- makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.2)
- makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.2,
+ makefile.linux    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.3rc1)
+ makefile.gcmmx    =>  Linux/ELF makefile (gcc, creates libpng12.so.0.1.2.3rc1,
                        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
@@ -75,6 +75,7 @@
  makefile.cygwin   =>  Cygwin/gcc makefile
  makefile.darwin   =>  Darwin makefile
  makefile.dec      =>  DEC Alpha UNIX makefile
+ makefile.hpgcc    =>  FreeBSD makefile
  makefile.hpgcc    =>  HPUX makefile using gcc
  makefile.hpux     =>  HPUX (10.20 and 11.00) makefile
  makefile.ibmc     =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
@@ -82,13 +83,13 @@
  libpng.icc        =>  Project file for IBM VisualAge/C++ version 4.0 or later
  makefile.macosx   =>  MACOS X Makefile
  makefile.netbsd   =>  NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
- makefile.ne12bsd  =>  NetBSD/cc makefile, uses PNGGCCRD, makes libpng0.so
+ 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.2)
+ makefile.sggcc    =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.3rc1)
  makefile.sunos    =>  Sun makefile
- makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.2)
- makefile.so9      =>  Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.2)
+ makefile.solaris  =>  Solaris 2.X makefile (gcc, creates libpng12.so.0.1.2.3rc1)
+ makefile.so9      =>  Solaris 9 makefile (gcc, creates libpng12.so.0.1.2.3rc1)
  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
diff --git a/KNOWNBUG b/KNOWNBUG
index 420012a..6413cbf 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,7 +1,24 @@
 
-Known bugs in libpng version 1.2.2
+Known bugs in libpng version 1.2.3rc1
 
-1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
+1. April 16, 2002: There are typographical errors in the following:
+   makefile.32sunu, makefile.64sunu, makefile.macosx, makefile.sgi,
+   and makefile.sggcc.
+
+   STATUS: Corrected versions are supplied in
+   libpng-1.2.2patch01-makefiles.tar.gz
+
+2. April 17, 2002: The symbolic link libpng.a -> /..path/lib/libpngNN.a
+   should simply be libpng.a -> libpngNN.a, to make it easier to move
+   the installed files.  Also, libpng.pc should be built at "make all"
+   time instead of "make install" time, to avoid root writing in user's
+   installation directory.
+
+   STATUS: Corrected versions of 15 makefiles are supplied in
+   libpng-1.2.2patch03-makefiles.tar.gz (includes replacements for
+   all of the patch01 and patch02 makefiles).
+
+3. 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
diff --git a/LICENSE b/LICENSE
index 7bdb0be..f43c86b 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.2, April 15, 2002, are
+libpng versions 1.0.7, July 1, 2000, through 1.2.3rc1, April 27, 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
-April 15, 2002
+April 27, 2002
diff --git a/README b/README
index bf32362..7268bd4 100644
--- a/README
+++ b/README
@@ -1,4 +1,4 @@
-README for libpng 1.2.2 - April 15, 2002 (shared library 2.1)
+README for libpng 1.2.3rc1 - April 27, 2002 (shared library 2.1)
 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.2)
+                            (gcc, creates libpng12.so.0.1.2.3rc1)
        makefile.gcmmx   =>  Linux/ELF makefile (gcc, creates
-                            libpng12.so.0.1.2.2, uses assembler code
+                            libpng12.so.0.1.2.3rc1, 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
@@ -199,6 +199,7 @@
        makefile.cygwin  =>  Cygwin/gcc makefile
        makefile.darwin  =>  Darwin makefile
        makefile.dec     =>  DEC Alpha UNIX makefile
+       makefile.freebsd =>  FreeBSD makefile
        makefile.hpgcc   =>  HPUX makefile using gcc
        makefile.hpux    =>  HPUX (10.20 and 11.00) makefile
        makefile.ibmc    =>  IBM C/C++ version 3.x for Win32 and OS/2 (static)
@@ -206,15 +207,15 @@
        libpng.icc       =>  Project file, IBM VisualAge/C++ 4.0 or later
        makefile.macosx  =>  MACOS X Makefile
        makefile.netbsd  =>  NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
-       makefile.ne12bsd =>  NetBSD/cc makefile, PNGGCCRD, makes libpng0.so
+       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.2)
+       makefile.sggcc   =>  Silicon Graphics (gcc, creates libpng12.so.0.1.2.3rc1)
        makefile.sunos   =>  Sun makefile
        makefile.solaris =>  Solaris 2.X makefile
-                            (gcc, creates libpng12.so.0.1.2.2)
+                            (gcc, creates libpng12.so.0.1.2.3rc1)
        makefile.so9     =>  Solaris 9 makefile
-                            (gcc, creates libpng12.so.0.1.2.2)
+                            (gcc, creates libpng12.so.0.1.2.3rc1)
        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
diff --git a/Y2KINFO b/Y2KINFO
index c222eda..24e990e 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
    Y2K compliance in libpng:
    =========================
 
-      April 15, 2002
+      April 27, 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.2 are Y2K compliant.  It is my belief that earlier
+      upward through 1.2.3rc1 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 e56d9ad..bdbe02e 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 echo "
-  There is no \"configure\" script for Libpng-1.2.2.  Instead, please
+  There is no \"configure\" script for Libpng-1.2.3rc1.  Instead, please
   copy the appropriate makefile for your system from the \"scripts\"
   directory.  Read the INSTALL file for more details.
 "
diff --git a/contrib/pngsuite/README b/contrib/pngsuite/README
deleted file mode 100644
index 714d12c..0000000
--- a/contrib/pngsuite/README
+++ /dev/null
@@ -1,85 +0,0 @@
-
-pngsuite
---------
-(c) Willem van Schaik, 1999
-
-Permission to use, copy, and distribute these images for any purpose and
-without fee is hereby granted.
-
-These 15 images are part of the much larger PngSuite test-set of 
-images, available for developers of PNG supporting software. The 
-complete set, available at http:/www.schaik.com/pngsuite/, contains 
-a variety of images to test interlacing, gamma settings, ancillary
-chunks, etc.
-
-The images in this directory represent the basic PNG color-types:
-grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
-(1-8 bit) and grayscale or color images with alpha channel. You
-can use them to test the proper functioning of PNG software.
-
-    filename      depth type
-    ------------ ------ --------------
-    basn0g01.png  1-bit grayscale
-    basn0g02.png  2-bit grayscale
-    basn0g04.png  4-bit grayscale
-    basn0g08.png  8-bit grayscale
-    basn0g16.png 16-bit grayscale
-    basn2c08.png  8-bit truecolor
-    basn2c16.png 16-bit truecolor
-    basn3p01.png  1-bit paletted
-    basn3p02.png  2-bit paletted
-    basn3p04.png  4-bit paletted
-    basn3p08.png  8-bit paletted
-    basn4a08.png  8-bit gray with alpha
-    basn4a16.png 16-bit gray with alpha
-    basn6a08.png  8-bit RGBA
-    basn6a16.png 16-bit RGBA
-
-Here is the correct result of typing "pngtest -m *.png" in
-this directory:
-
-Testing basn0g01.png: PASS (524 zero samples)
- Filter 0 was used 32 times
-Testing basn0g02.png: PASS (448 zero samples)
- Filter 0 was used 32 times
-Testing basn0g04.png: PASS (520 zero samples)
- Filter 0 was used 32 times
-Testing basn0g08.png: PASS (3 zero samples)
- Filter 1 was used 9 times
- Filter 4 was used 23 times
-Testing basn0g16.png: PASS (1 zero samples)
- Filter 1 was used 1 times
- Filter 2 was used 31 times
-Testing basn2c08.png: PASS (6 zero samples)
- Filter 1 was used 5 times
- Filter 4 was used 27 times
-Testing basn2c16.png: PASS (592 zero samples)
- Filter 1 was used 1 times
- Filter 4 was used 31 times
-Testing basn3p01.png: PASS (512 zero samples)
- Filter 0 was used 32 times
-Testing basn3p02.png: PASS (448 zero samples)
- Filter 0 was used 32 times
-Testing basn3p04.png: PASS (544 zero samples)
- Filter 0 was used 32 times
-Testing basn3p08.png: PASS (4 zero samples)
- Filter 0 was used 32 times
-Testing basn4a08.png: PASS (32 zero samples)
- Filter 1 was used 1 times
- Filter 4 was used 31 times
-Testing basn4a16.png: PASS (64 zero samples)
- Filter 0 was used 1 times
- Filter 1 was used 2 times
- Filter 2 was used 1 times
- Filter 4 was used 28 times
-Testing basn6a08.png: PASS (160 zero samples)
- Filter 1 was used 1 times
- Filter 4 was used 31 times
-Testing basn6a16.png: PASS (1072 zero samples)
- Filter 1 was used 4 times
- Filter 4 was used 28 times
-libpng passes test
-
-Willem van Schaik
-<willem@schaik.com>
-October 1999
diff --git a/libpng.3 b/libpng.3
index 2f75466..1e5c1d5 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "April 15, 2002"
+.TH LIBPNG 3 "April 27, 2002"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.2
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.3rc1
 .SH SYNOPSIS
 \fI\fB
 
@@ -776,14 +776,6 @@
 
 \fI\fB
 
-\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
-
-\fI\fB
-
-\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
-
-\fI\fB
-
 .SH DESCRIPTION
 The
 .I libpng
@@ -795,7 +787,7 @@
 .SH LIBPNG.TXT
 libpng.txt - A description on how to use and modify libpng
 
- libpng version 1.2.2 - April 15, 2002
+ libpng version 1.2.3rc1 - April 27, 2002
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998-2002 Glenn Randers-Pehrson
@@ -3646,13 +3638,13 @@
 
 .SH IX. Y2K Compliance in libpng
 
-April 15, 2002
+April 27, 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.2 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.3rc1 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
@@ -3781,6 +3773,7 @@
  1.2.2rc1            12    10202  12.so.0.1.2.2rc1
  1.0.13              10    10013  10.so.0.1.0.13
  1.2.2               12    10202  12.so.0.1.2.2
+ 1.2.3rc1            12    10203  12.so.0.1.2.3rc1
 
 Henceforth the source version will match the shared-library minor
 and patch numbers; the shared-library major version number will be
@@ -3838,7 +3831,7 @@
 
 Thanks to Frank J. T. Wojcik for helping with the documentation.
 
-Libpng version 1.2.2 - April 15, 2002:
+Libpng version 1.2.3rc1 - April 27, 2002:
 Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
 Currently maintained by Glenn Randers-Pehrson (randeg@alum.rpi.edu).
 
@@ -3855,7 +3848,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.2, April 15, 2002, are
+libpng versions 1.0.7, July 1, 2000, through 1.2.3rc1, April 27, 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
@@ -3947,7 +3940,7 @@
 
 Glenn Randers-Pehrson
 randeg@alum.rpi.edu
-April 15, 2002
+April 27, 2002
 
 .\" end of man page
 
diff --git a/libpng.txt b/libpng.txt
index afa8f38..8197dc6 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.2 - April 15, 2002
+ libpng version 1.2.3rc1 - April 27, 2002
  Updated and distributed by Glenn Randers-Pehrson
  <randeg@alum.rpi.edu>
  Copyright (c) 1998-2002 Glenn Randers-Pehrson
@@ -2851,13 +2851,13 @@
 
 IX. Y2K Compliance in libpng
 
-April 15, 2002
+April 27, 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.2 are Y2K compliant.  It is my belief that earlier
+upward through 1.2.3rc1 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 564dc98..d6aaf1b 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "April 15, 2002"
+.TH LIBPNGPF 3 "April 27, 2002"
 .SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.2
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.3rc1
 (private functions)
 .SH SYNOPSIS
 \fB#include <png.h>\fP
@@ -531,6 +531,14 @@
 
 \fI\fB
 
+\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
+
+\fI\fB
+
+\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
+
+\fI\fB
+
 .SH DESCRIPTION
 The functions listed above are used privately by libpng
 and are not recommended for use by applications.  They are
diff --git a/png.5 b/png.5
index d61d281..478357a 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "April 15, 2002"
+.TH PNG 5 "April 27, 2002"
 .SH NAME
 png \- Portable Network Graphics (PNG) format
 .SH DESCRIPTION
diff --git a/png.c b/png.c
index 7cff5e6..104c4df 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
 
 /* png.c - location for general purpose libpng functions
  *
- * libpng version 1.2.2 - April 15, 2002
+ * libpng version 1.2.3rc1 - April 27, 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_2 Your_png_h_is_not_version_1_2_2;
+typedef version_1_2_3rc1 Your_png_h_is_not_version_1_2_3rc1;
 
 /* 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.2";
+const char png_libpng_ver[18] = "1.2.3rc1";
 
 /* 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.2 - April 15, 2002\n\
+   return ((png_charp) "\n libpng version 1.2.3rc1 - April 27, 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.2");
-   return((png_charp) "1.2.2");
+      return((png_charp) "1.2.3rc1");
+   return((png_charp) "1.2.3rc1");
 }
 
 png_charp PNGAPI
@@ -732,7 +732,7 @@
 png_access_version_number(void)
 {
    /* Version of *.c files used when building libpng */
-   return((png_uint_32) 10202L);
+   return((png_uint_32) 10203L);
 }
 
 
diff --git a/png.h b/png.h
index 94026b2..702d3e9 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,6 @@
-
 /* png.h - header file for PNG reference library
  *
- * libpng version 1.2.2 - April 15, 2002
+ * libpng version 1.2.3rc1 - April 27, 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.)
@@ -9,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.2 - April 15, 2002: Glenn
+ *  libpng versions 0.97, January 1998, through 1.2.3rc1 - April 27, 2002: Glenn
  *  See also "Contributing Authors", below.
  *
  * Note about libpng version numbers:
@@ -87,6 +86,7 @@
  *    1.2.2rc1                12    10202  12.so.0.1.2.2rc1
  *    1.0.13                  10    10013  10.so.0.1.0.13
  *    1.2.2                   12    10202  12.so.0.1.2.2
+ *    1.2.3rc1                12    10203  12.so.0.1.2.3rc1
  *
  *    Henceforth the source version will match the shared-library major
  *    and minor numbers; the shared-library major version number will be
@@ -116,7 +116,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.2, April 15, 2002, are
+ * libpng versions 1.0.7, July 1, 2000, through 1.2.3rc1, April 27, 2002, are
  * Copyright (c) 2000-2001 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
@@ -221,13 +221,13 @@
  * Y2K compliance in libpng:
  * =========================
  *
- *    April 15, 2002
+ *    April 27, 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.2 are Y2K compliant.  It is my belief that earlier
+ *    upward through 1.2.3rc1 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
@@ -283,7 +283,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.2"
+#define PNG_LIBPNG_VER_STRING "1.2.3rc1"
 
 #define PNG_LIBPNG_VER_SONUM   0
 #define PNG_LIBPNG_VER_DLLNUM  %DLLNUM%
@@ -291,11 +291,11 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   2
-#define PNG_LIBPNG_VER_RELEASE 2
+#define PNG_LIBPNG_VER_RELEASE 3
 /* This should match the numeric part of the final component of
  * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
 
-#define PNG_LIBPNG_VER_BUILD  0
+#define PNG_LIBPNG_VER_BUILD  1
 
 #define PNG_LIBPNG_BUILD_ALPHA    1
 #define PNG_LIBPNG_BUILD_BETA     2
@@ -303,14 +303,14 @@
 #define PNG_LIBPNG_BUILD_STABLE   4
 #define PNG_LIBPNG_BUILD_TYPEMASK 7
 #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with STABLE only */
-#define PNG_LIBPNG_BUILD_TYPE 4
+#define PNG_LIBPNG_BUILD_TYPE 3
 
 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
  * We must not include leading zeros.
  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release */
-#define PNG_LIBPNG_VER 10202 /* 1.2.2 */
+#define PNG_LIBPNG_VER 10203 /* 1.2.3 */
 
 #ifndef PNG_VERSION_INFO_ONLY
 
@@ -1263,9 +1263,9 @@
 
 
 /* This prevents a compiler error in png.c if png.c and png.h are both at
-   version 1.2.2
+   version 1.2.3rc1
  */
-typedef png_structp version_1_2_2;
+typedef png_structp version_1_2_3rc1;
 
 typedef png_struct FAR * FAR * png_structpp;
 
@@ -1817,13 +1817,6 @@
 /* frees a pointer allocated by png_malloc() */
 extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
 
-/* Function to allocate memory for zlib. */
-extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
-   uInt size));
-
-/* Function to free memory for zlib */
-extern PNG_EXPORT(void,png_zfree) PNGARG((voidpf png_ptr, voidpf ptr));
-
 /* Free data that was allocated internally */
 extern PNG_EXPORT(void,png_free_data) PNGARG((png_structp png_ptr,
    png_infop info_ptr, png_uint_32 free_me, int num));
@@ -2394,7 +2387,7 @@
 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
 
 #define PNG_HEADER_VERSION_STRING \
-   " libpng version 1.2.2 - April 15, 2002 (header)\n"
+   " libpng version 1.2.3rc1 - April 27, 2002 (header)\n"
 
 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
 /* With these routines we avoid an integer divide, which will be slower on
@@ -2663,6 +2656,12 @@
 PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
    png_infop info_ptr));
 
+/* Function to allocate memory for zlib. */
+PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
+
+/* Function to free memory for zlib */
+PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
+
 /* Reset the CRC variable */
 PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
 
diff --git a/pngasmrd.h b/pngasmrd.h
index d00eb34..3d5eb51 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.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 f542049..2676fd3 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,6 +1,6 @@
 /* pngconf.h - machine configurable file for libpng
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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)
@@ -78,12 +78,12 @@
  *   (no define)   -- building static library, or building an
  *                    application and linking to the static lib
  * 'Cygwin' defines/defaults:
- *   PNG_BUILD_DLL -- building the dll
- *   (no define)   -- building an application, linking to the dll
- *   PNG_STATIC    -- building the static lib, or building an application
- *                    that links to the static lib.
- *   ALL_STATIC    -- building various static libs, or building an application
- *                    that links to the static libs.
+ *   PNG_BUILD_DLL -- (ignored) building the dll
+ *   (no define)   -- (ignored) building an application, linking to the dll
+ *   PNG_STATIC    -- (ignored) building the static lib, or building an 
+ *                    application that links to the static lib.
+ *   ALL_STATIC    -- (ignored) building various static libs, or building an 
+ *                    application that links to the static libs.
  * Thus,
  * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
  * this bit of #ifdefs will define the 'correct' config variables based on
@@ -94,7 +94,14 @@
  *   ALL_STATIC (since we can't #undef something outside our namespace)
  *   PNG_BUILD_DLL
  *   PNG_STATIC
- *   (nothing) == PNG_USE_DLL 
+ *   (nothing) == PNG_USE_DLL
+ * 
+ * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
+ *   of auto-import in binutils, we no longer need to worry about 
+ *   __declspec(dllexport) / __declspec(dllimport) and friends.  Therefore,
+ *   we don't need to worry about PNG_STATIC or ALL_STATIC.  However, we
+ *   DO need to worry about PNG_BUILD_DLL because that changes some defaults
+ *   such as CONSOLE_IO.
  */
 #if defined(__CYGWIN__)
 #  if defined(ALL_STATIC)
@@ -1149,10 +1156,16 @@
 #  endif
 #endif
 
+#if defined(__CYGWIN__)
+#  undef PNGAPI
+#  define PNGAPI __cdecl
+#  undef PNG_IMPEXP
+#  define PNG_IMPEXP
+#endif  
 
 #ifndef PNGAPI
 
-#if defined(__MINGW32__) || defined(__CYGWIN__) && !defined(PNG_MODULEDEF)
+#if defined(__MINGW32__) && !defined(PNG_MODULEDEF)
 #  ifndef PNG_NO_MODULEDEF
 #    define PNG_NO_MODULEDEF
 #  endif
@@ -1165,7 +1178,7 @@
 #if defined(PNG_DLL) || defined(_DLL) || defined(__DLL__ ) || \
     (( defined(_Windows) || defined(_WINDOWS) || \
        defined(WIN32) || defined(_WIN32) || defined(__WIN32__) \
-	  ) && !defined(__CYGWIN__))
+	  ))
 
 #  if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
 #    define PNGAPI __cdecl
@@ -1208,12 +1221,6 @@
 #     endif
 #  endif  /* PNG_IMPEXP */
 #else /* !(DLL || non-cygwin WINDOWS) */
-#  if defined(__CYGWIN__) && !defined(PNG_DLL)
-#    if !defined(PNG_IMPEXP)
-#      define PNG_IMPEXP
-#    endif
-#    define PNGAPI __cdecl
-#  else
 #    if (defined(__IBMC__) || defined(IBMCPP__)) && defined(__OS2__)
 #      define PNGAPI _System
 #      define PNG_IMPEXP
@@ -1224,7 +1231,6 @@
 #        define PNG_IMPEXP
 #      endif
 #    endif
-#  endif
 #endif
 #endif
 
diff --git a/pngerror.c b/pngerror.c
index 5f2628b..8ab091f 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
 
 /* pngerror.c - stub functions for i/o and memory allocation
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 7f4f2ed..993a387 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.2 - April 15, 2002
+ * libpng version 1.2.3rc1 - April 27, 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/pngget.c b/pngget.c
index 9bafb91..79792af 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
 
 /* pngget.c - retrieval of values from info struct
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngmem.c b/pngmem.c
index 8bae129..540e9eb 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
 
 /* pngmem.c - stub functions for memory allocation
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngpread.c b/pngpread.c
index ba2c5b3..2607c75 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
 
 /* pngpread.c - read a png file in push mode
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngread.c b/pngread.c
index 44d937f..b9c6a35 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
 
 /* pngread.c - read a PNG file
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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)
@@ -148,6 +148,19 @@
 
    png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
 
+#ifdef PNG_SETJMP_SUPPORTED
+/* Applications that neglect to set up their own setjmp() and then encounter
+   a png_error() will longjmp here.  Since the jmpbuf is then meaningless we
+   abort instead of returning. */
+#ifdef USE_FAR_KEYWORD
+   if (setjmp(jmpbuf))
+      PNG_ABORT();
+   png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+#else
+   if (setjmp(png_ptr->jmpbuf))
+      PNG_ABORT();
+#endif
+#endif
    return (png_ptr);
 }
 
@@ -782,7 +795,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.2
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.3rc1
  */
 
 void PNGAPI
@@ -831,7 +844,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.2
+ * [*] png_handle_alpha() does not exist yet, as of libpng version 1.2.3rc1
  */
 void PNGAPI
 png_read_image(png_structp png_ptr, png_bytepp image)
diff --git a/pngrio.c b/pngrio.c
index 265f4e3..a0d4e52 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
 
 /* pngrio.c - functions for data input
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 8628b0e..f343134 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.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngrutil.c b/pngrutil.c
index 74f2d8b..1d65ac9 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
 
 /* pngrutil.c - utilities to read a PNG file
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngset.c b/pngset.c
index ddbb4c1..453ff57 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
 
 /* pngset.c - storage of image information into info struct
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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/pngtest.c b/pngtest.c
index fdf454e..83be28e 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
 
 /* pngtest.c - a simple test program to test libpng
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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)
@@ -1512,4 +1512,4 @@
 }
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_2 your_png_h_is_not_version_1_2_2;
+typedef version_1_2_3rc1 your_png_h_is_not_version_1_2_3rc1;
diff --git a/pngtrans.c b/pngtrans.c
index 6a9ad0e..c6bb0b7 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.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 53851fd..5990bf4 100644
--- a/pngvcrd.c
+++ b/pngvcrd.c
@@ -2,7 +2,7 @@
  *
  * For Intel x86 CPU and Microsoft Visual C++ compiler
  *
- * libpng version 1.2.2 - April 15, 2002
+ * libpng version 1.2.3rc1 - April 27, 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 4d195f9..7818251 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
 
 /* pngwio.c - functions for data output
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 863a914..c1bd41c 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
 
 /* pngwrite.c - general routines to write a PNG file
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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)
@@ -530,7 +530,20 @@
       1, png_doublep_NULL, png_doublep_NULL);
 #endif
 
-   return ((png_structp)png_ptr);
+#ifdef PNG_SETJMP_SUPPORTED
+/* Applications that neglect to set up their own setjmp() and then encounter
+   a png_error() will longjmp here.  Since the jmpbuf is then meaningless we
+   abort instead of returning. */
+#ifdef USE_FAR_KEYWORD
+   if (setjmp(jmpbuf))
+      PNG_ABORT();
+   png_memcpy(png_ptr->jmpbuf,jmpbuf,sizeof(jmp_buf));
+#else
+   if (setjmp(png_ptr->jmpbuf))
+      PNG_ABORT();
+#endif
+#endif
+   return (png_ptr);
 }
 
 /* Initialize png_ptr structure, and allocate any memory needed */
diff --git a/pngwtran.c b/pngwtran.c
index b4a8715..2462c41 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.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 599290b..5688b9f 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
 
 /* pngwutil.c - utilities to write a PNG file
  *
- * libpng 1.2.2 - April 15, 2002
+ * libpng 1.2.3rc1 - April 27, 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 6723cf8..3c5eee8 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.2 (April 15, 2002) and zlib
+libpng 1.2.3rc1 (April 27, 2002) and zlib
 
 Copyright (C) 2000 Simon-Pierre Cadieux
 For conditions of distribution and use, see copyright notice in png.h
diff --git a/projects/msvc/png32ms.def b/projects/msvc/png32ms.def
index 8d45d8b..8eb9636 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.2
+;Version 1.2.3rc1
   png_build_grayscale_palette  @1
   png_check_sig        @2
   png_chunk_error      @3
@@ -213,5 +213,6 @@
   png_set_strip_error_numbers @193
 ; Added at version 1.2.2
   png_handle_as_unknown @194
-  png_zalloc @195
-  png_zfree @196
+; Added at version 1.2.2 and deleted from version 1.2.3
+; png_zalloc @195
+; png_zfree @196
diff --git a/projects/netware.txt b/projects/netware.txt
index b74efa5..4663dcd 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.2-project-netware.zip from a libpng distribution
+libpng-1.2.3rc1-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.2-project-netware.zip"
+"unzip -a libpng-1.2.3rc1-project-netware.zip"
diff --git a/projects/wince.txt b/projects/wince.txt
index 2b8ee6f..ef04fab 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.2-project-wince.zip from a libpng distribution
+libpng-1.2.3rc1-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.2-project-wince.zip"
+"unzip -a libpng-1.2.3rc1-project-wince.zip"
diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in
index 2808d5b..3fdffc4 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.2
+Version: 1.2.3rc1
 Libs: -L${libdir} -lpng12
 Cflags: -I${includedir}/libpng12
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index 4d12233..817c8e4 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -33,11 +33,22 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -50,12 +61,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -85,42 +99,61 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
+
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
-	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
+	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
+	pngtest pngout.png
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index 4b2fe85..3c0a0a6 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -33,11 +33,22 @@
 
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -50,12 +61,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -85,42 +99,61 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
+
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
-	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
+	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
+	pngtest pngout.png
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index ef8c3bd..b79bab6 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -1,7 +1,8 @@
 # makefile for libpng using gcc (generic, static library)
-# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
+# Copyright (C) 2002 Glenn Randers-Pehrson
 # Copyright (C) 2000 Cosmin Truta
 # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
+# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
 # Location of the zlib library and include files
@@ -18,13 +19,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 prefix=/usr/local
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
 
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
+
 CDEBUG = -g -DPNG_DEBUG=5
 LDDEBUG =
 CRELEASE = -O2
@@ -56,14 +67,17 @@
 	$(LD) -o $@ pngtest$(O) $(LDFLAGS)
 
 install: libpng.a
-	-@if [ ! -d $(INCPATH)  ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/libpng  ]; then mkdir $(INCPATH)/libpng; fi
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@rm $(INCPATH)/png.h
-	-@rm $(INCPATH)/pngconf.h
-	cp png.h pngconf.h $(INCPATH)/libpng
-	chmod 644 $(INCPATH)/libpng/png.h $(INCPATH)/libpng/pngconf.h
-	cp libpng.a $(LIBPATH)
+	-@if [ ! -d $(DESTDIR)$(INCPATH)  ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/libpng  ]; then mkdir \
+	$(DESTDIR)$(INCPATH)/libpng; fi
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@rm $(DESTDIR)$(INCPATH)/png.h
+	-@rm $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h \
+	$(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	cp libpng.a $(DESTDIR)$(LIBPATH)
 
 clean:
 	/bin/rm -f *.o libpng.a pngtest pngout.png
diff --git a/scripts/makefile.atari b/scripts/makefile.atari
index c51ad6e..bc4d570 100644
--- a/scripts/makefile.atari
+++ b/scripts/makefile.atari
@@ -1,4 +1,5 @@
 # makefile for libpng
+# Copyright (C) 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
 # modified for LC56/ATARI assumes libz.lib is in same dir and uses default
@@ -10,6 +11,18 @@
 
 # where make install puts libpng.a and png.h
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
 	$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
@@ -25,12 +38,14 @@
 	$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
 
 install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	-@rm -f $(prefix)/include/png.h
-	-@rm -f $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
+	-@mkdir $(DESTDIR)$(INCPATH)
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
+	-@mkdir $(DESTDIR)$(LIBPATH)
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h $(DESTDIR)$(INCPATH)/libpng
+	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index c0e957e..4fc6d59 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -14,7 +14,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 ALIGN=
@@ -39,6 +39,18 @@
 prefix=/usr/local
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
+
 LIBNAME=libpng12
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
@@ -49,12 +61,15 @@
 
 .SUFFIXES:      .c .o
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 	cp $(LIBNAME).so* /boot/home/config/lib
@@ -74,41 +89,56 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index b7e3a59..a25c554 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -8,6 +8,16 @@
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
 
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
+
 # To enable assembler optimizations, add '-DPNG_USE_PNGGCCRD' to
 # $CFLAGS, and include pnggccrd.o in $OBJS, below.
 
@@ -21,8 +31,8 @@
 prefix=/usr
 
 # Where the zlib library and include files are located
-ZLIBLIB=${prefix}/lib
-ZLIBINC=${prefix}/include
+ZLIBLIB=$(DESTDIR)$(LIBPATH)
+ZLIBINC=$(DESTDIR)$(INCPATH)
 #ZLIBLIB=../zlib
 #ZLIBINC=../zlib
 
@@ -39,10 +49,10 @@
 CFLAGS=$(MINGW_CCFLAGS) -I$(ZLIBINC) -Wall -O3 $(ALIGN) -funroll-loops \
 	-fomit-frame-pointer
 
+LIBNAME=libpng12
 PNGMAJ = 0
-#PNGDLL = $12
-PNGMIN = 1.2.2
-PNGMIN_BASE = 1.2.2
+PNGDLL = 12
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 SHAREDLIB=cygpng$(PNGDLL).dll
@@ -53,18 +63,19 @@
 EXE=.exe
 
 LDFLAGS=-L. $(MINGW_LDFLAGS) -L$(ZLIBLIB) -lpng -lz
-LDSFLAGS=-shared -L.  $(MINGW_LDFLAGS) -Wl,--enable-auto-image-base
-LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(SHAREDDEF)
+LDSFLAGS=-shared -L.  $(MINGW_LDFLAGS) -Wl,--export-all
+LDEXTRA=-Wl,--out-implib=$(IMPLIB)
 
 RANLIB=ranlib
 #RANLIB=echo
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+
 BINPATH=$(prefix)/bin
 MANPATH=$(prefix)/man
 MAN3PATH=$(MANPATH)/man3
-DOCPATH=$(prefix)/doc/libpng-$(PNGMIN_BASE)
+MAN5PATH=$(MANPATH)/man5
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -75,12 +86,15 @@
 .SUFFIXES:      .c .o .pic.o
 
 %.o : %.c
-	$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $<
+	$(CC) -c $(CFLAGS) -o $@ $<
 
 %.pic.o : %.c
 	$(CC) -c $(CFLAGS) -DPNG_BUILD_DLL -o $@ $<
 
-all: all-static all-shared
+all: all-static all-shared libpng.pc
+
+libpng.pc: scripts/libpng.pc.in
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
 static: all-static
 
@@ -95,7 +109,7 @@
 	@echo '    You can ignore the single "control reaches end of non-void function"'
 	@echo '    warning and multiple "<variable> defined but not used" warnings:'
 	@echo ""
-	$(CC) -c $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -o $@ $*.c
+	$(CC) -c $(CFLAGS) -o $@ $*.c
 
 pnggccrd.pic.o:	png.h pngconf.h
 	@echo ""
@@ -125,7 +139,7 @@
 	$(CC) $(CFLAGS) -c $< -o $@
 
 pngtest.o: pngtest.c
-	$(CC) $(CFLAGS) -DPNG_STATIC -DZLIB_STATIC -c $< -o $@
+	$(CC) $(CFLAGS) -c $< -o $@
 
 test: test-static test-shared
 
@@ -137,30 +151,38 @@
 
 install: install-static install-shared
 
-install-static: $(STATLIB) install-headers install-docs install-man
-	-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi
-	install -m 755 $(STATLIB) $(LIBPATH)
+install-static: $(STATLIB) install-headers install-man
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir -p $(DESTDIR)$(LIBPATH); fi
+	install -m 644 $(STATLIB) $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@rm -f $(DESTDIR)$(LIBPATH)/$(STATLIB)
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a $(STATLIB))
 
-install-shared: $(SHAREDLIB) install-headers install-docs install-man
-	-@if [ ! -d $(LIBPATH) ]; then mkdir -p $(LIBPATH); fi
-	-@if [ ! -d $(BINPATH) ]; then mkdir -p $(BINPATH); fi
-	install -m 755 $(IMPLIB) $(LIBPATH)
-	install -s -m 755 $(SHAREDLIB) $(BINPATH)
+install-shared: $(SHAREDLIB) libpng.pc install-headers install-man
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir -p $(DESTDIR)$(LIBPATH); fi
+	-@if [ ! -d $(DESTDIR)$(BINPATH) ]; then mkdir -p $(DESTDIR)$(BINPATH); fi
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir -p $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	install -m 644 $(IMPLIB) $(DESTDIR)$(LIBPATH)/$(LIBNAME).dll.a
+	-@rm -f $(DESTDIR)$(LIBPATH)/$(IMPLIB)
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).dll.a $(IMPLIB))
+	install -s -m 755 $(SHAREDLIB) $(DESTDIR)$(BINPATH)
+	install -m 644 libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/$(LIBNAME).pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
 install-headers:
-	-@if [ ! -d $(INCPATH)]; then mkdir -p $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/libpng  ]; then mkdir -p $(INCPATH)/libpng; fi
-	-@rm -f ${INCPATH)/png.h
-	-@rm -f ${INCPATH)/pngconf.h
-	install -m 644 png.h pngconf.h $(INCPATH)
-
-install-docs:
-	-@if [ ! -d $(DOCPATH) ]; then mkdir -p $(DOCPATH); fi
-	install -m 644 $(DOCS) $(DOCPATH)
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir -p $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then mkdir -p $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	install -m 644 png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	-@rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-man:
-	-@if [ ! -d $(MAN3PATH) ]; then mkdir -p $(MAN3PATH); fi
-	install -m 644 libpngpf.3 libpng.3 $(MAN3PATH)
+	-@if [ ! -d $(DESTDIR)$(MAN3PATH) ]; then mkdir -p $(DESTDIR)$(MAN3PATH); fi
+	-@if [ ! -d $(DESTDIR)$(MAN5PATH) ]; then mkdir -p $(DESTDIR)$(MAN5PATH); fi
+	install -m 644 libpngpf.3 libpng.3 $(DESTDIR)$(MAN3PATH)
+	install -m 644 png.5 $(DESTDIR)$(MAN5PATH)
 
 clean:
 	/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index cefb724..936d467 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -25,12 +25,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -43,12 +54,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
 
-all: libpng.a $(LIBNAME).dylib pngtest
+all: libpng.a $(LIBNAME).dylib pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).dylib: $(LIBNAME).$(PNGMAJ).dylib
 	ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib
 
@@ -57,7 +71,7 @@
 
 $(LIBNAME).$(PNGVER).dylib: $(OBJSDLL)
 	$(CC) -dynamiclib \
-	 -install_name $(LIBPATH)/$(LIBNAME).$(PNGMAJ).dylib \
+	 -install_name $(DESTDIR)$(LIBPATH)/$(LIBNAME).$(PNGMAJ).dylib \
 	 -current_version $(PNGMIN) -compatibility_version $(PNGMIN) \
 	 -o $(LIBNAME).$(PNGVER).dylib \
 	 $(OBJSDLL) -L$(ZLIBLIB) -lz
@@ -69,42 +83,54 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h $(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).dylib
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.dylib
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).dylib
-	-@/bin/rm -f $(LIBPATH)/libpng.dylib
-	-@/bin/rm -f $(LIBPATH)/libpng.3.dylib
-	-@/bin/rm -f $(LIBPATH)/libpng.3.*.dylib
-	cp $(LIBNAME).$(PNGVER).dylib $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).dylib
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.dylib
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).dylib
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.dylib
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.3.dylib
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.3.*.dylib
+	cp $(LIBNAME).$(PNGVER).dylib $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).$(PNGVER).dylib
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).$(PNGVER).dylib libpng.dylib; \
 	ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.dylib; \
 	ln -sf $(LIBNAME).$(PNGVER).dylib libpng.3.$(PNGMIN).dylib; \
 	ln -sf $(LIBNAME).$(PNGVER).dylib $(LIBNAME).$(PNGMAJ).dylib; \
 	ln -sf $(LIBNAME).$(PNGMAJ).dylib $(LIBNAME).dylib)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	rm -f *.o libpng.a $(LIBNAME).*dylib pngtest pngout.png
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index 55b1695..fb80cd1 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -1,5 +1,5 @@
 # makefile for libpng on DEC Alpha Unix
-# Copyright (C) 2000 Glenn Randers-Pehrson
+# Copyright (C) 2000-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
 
@@ -7,6 +7,17 @@
 prefix=/usr/local
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib
@@ -17,7 +28,7 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
@@ -32,12 +43,15 @@
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
 
-all: $(LIBNAME).so libpng.a pngtest
+all: $(LIBNAME).so libpng.a pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -54,41 +68,56 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
diff --git a/scripts/makefile.dj2 b/scripts/makefile.dj2
index 8ba1770..09045c2 100644
--- a/scripts/makefile.dj2
+++ b/scripts/makefile.dj2
@@ -1,10 +1,13 @@
 # DJGPP (DOS gcc) makefile for libpng
+# Copyright (C) 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 will put libpng.a and png.h
 #prefix=/usr/local
 prefix=.
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
 
 CC=gcc
 CFLAGS=-I../zlib -O
diff --git a/scripts/makefile.freebsd b/scripts/makefile.freebsd
index 3423768..717e755 100644
--- a/scripts/makefile.freebsd
+++ b/scripts/makefile.freebsd
@@ -3,8 +3,23 @@
 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
 # For conditions of distribution and use, see copyright notice in png.h
 
+.include <bsd.own.mk>
+
 # where make install puts libpng.a and png.h
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 PNGMAJ= 5
 .if (${OBJFORMAT} == "elf")
@@ -49,23 +64,22 @@
 	./pngtest
 
 install: libpng.a libpng.so.${PNGVER}
-	-@mkdir $(prefix)/include/libpng
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
 	${INSTALL} -o ${INCOWN} -g ${INCGRP} -m ${INCMODE} \
-		png.h pngconf.h $(prefix)/include/libpng
-	ln -sf libpng/png.h $(prefix)/include/png.h
-	ln -sf libpng/pngconf.h $(prefix)/include/pngconf.h
+		png.h pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); rm -f png.h pngconf.h; ln -sf libpng/*.h .)
 	${INSTALL} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
-		libpng.a libpng.so.${PNGVER} $(prefix)/lib
-	$(RANLIB) $(prefix)/lib/libpng.a
-	ln -sf libpng.so.${PNGVER} $(prefix)/lib/libpng.so
+		libpng.a libpng.so.${PNGVER} $(DESTDIR)$(LIBPATH)
+	$(RANLIB) $(DESTDIR)$(LIBPATH)/libpng.a
+	ln -sf libpng.so.${PNGVER} $(DESTDIR)$(LIBPATH)/libpng.so
 	/sbin/ldconfig -R
 	${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
-		libpng.3 libpngpf.3 $(prefix)/man/man3
+		libpng.3 libpngpf.3 $(DESTDIR)$(MANPATH)/man3
 	${INSTALL} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE} \
-		png.5 $(prefix)/man/man5
+		png.5 $(DESTDIR)$(MANPATH)/man5
 
 clean:
-	rm -f *.o libpng.a libpng.so libpng.so.${PNGVER} pngtest pngout.png
+	rm -f *.o *.so libpng.a libpng.so.${PNGVER} pngtest pngout.png
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
 writelock:
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index 18a5070..a9b376b 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -15,7 +15,7 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
@@ -62,6 +62,17 @@
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -74,7 +85,10 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest pngtest-static
+all: libpng.a $(LIBNAME).so pngtest pngtest-static libpng.pc
+
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
 pnggccrd.o:	pnggccrd.c png.h pngconf.h
 	$(CC) -c $(CFLAGS) -o $@ $*.c
@@ -82,7 +96,7 @@
 pnggccrd.pic.o:	pnggccrd.c png.h pngconf.h
 	$(CC) -c $(CFLAGS) -fPIC -o $@ pnggccrd.c
 
-$(LIBNAME).a: $(OBJS)
+libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
@@ -99,7 +113,7 @@
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 
-pngtest-static: pngtest.o $(LIBNAME).a
+pngtest-static: pngtest.o libpng.a
 	$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
 
 test: pngtest pngtest-static
@@ -113,41 +127,56 @@
 	./pngtest-static
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index 081a01e..a504005 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -35,12 +35,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -53,12 +64,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).sl pngtest
+all: libpng.a $(LIBNAME).sl pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
 	ln -f -s $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 
@@ -77,41 +91,57 @@
 
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then \
+	mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).sl.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).sl
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).sl.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
 	ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
 	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then mkdir \
+	$(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(SHAREDLIB).sl $(SHAREDLIB).sl.$(PNGMAJ)* \
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index 996cb95..f31692d 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -19,14 +19,25 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 # where make install puts libpng.a, libpng12.sl, and png.h
 prefix=/opt/libpng
-LIBPATH=$prefix/lib
-INCPATH=$prefix/include
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -39,12 +50,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) +z -o $@ $*.c
 
-all: libpng.a $(LIBNAME).sl pngtest
+all: libpng.a $(LIBNAME).sl pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).sl: $(LIBNAME).sl.$(PNGMAJ)
 	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl
 
@@ -63,41 +77,56 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).sl.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).sl
-	-@/bin/rm -f $(LIBPATH)/libpng.sl
-	-@/bin/rm -f $(LIBPATH)/libpng.sl.3
-	-@/bin/rm -f $(LIBPATH)/libpng.sl.3.*
-	cp $(LIBNAME).sl.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).sl.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).sl
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.sl
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.sl.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.sl.3.*
+	cp $(LIBNAME).sl.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).sl.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl; \
 	ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3; \
 	ln -sf $(LIBNAME).sl.$(PNGVER) libpng.sl.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).sl.$(PNGVER) $(LIBNAME).sl.$(PNGMAJ); \
 	ln -sf $(LIBNAME).sl.$(PNGMAJ) $(LIBNAME).sl)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).sl $(LIBNAME).sl.$(PNGMAJ)* \
diff --git a/scripts/makefile.knr b/scripts/makefile.knr
index 4d7707b..1e59fda 100644
--- a/scripts/makefile.knr
+++ b/scripts/makefile.knr
@@ -1,4 +1,5 @@
 # makefile for libpng
+# Copyright (C) 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
 
@@ -9,6 +10,18 @@
 
 # where make install puts libpng.a and png.h
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 CC=cc
 CFLAGS=-I../zlib -O
@@ -46,17 +59,18 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	-@rm -f $(prefix)/include/png.h
-	-@rm -f $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
-	cp libpng.a $(prefix)/lib
-	chmod 644 $(prefix)/lib/libpng.a
+	-@mkdir $(DESTDIR)$(INCPATH)
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
+	-@mkdir $(DESTDIR)$(LIBPATH)
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h $(DESTDIR)$(INCPATH)/libpng
+	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	cp libpng.a $(DESTDIR)$(LIBPATH)
+	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png ansi2knr
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index a87721f..633d00c 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -5,12 +5,12 @@
 
 LIBNAME = libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 CC=gcc
 
-# where "make install" puts libpng.a, libpng12/libpng12.so*,
+# where "make install" puts libpng12.a, libpng12/libpng12.so*,
 # libpng12/png.h and libpng12/pngconf.h
 prefix=/usr/local
 
@@ -41,6 +41,17 @@
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -53,12 +64,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -73,7 +87,7 @@
 pngtest: pngtest.o $(LIBNAME).so
 	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
 
-pngtest-static: pngtest.o $(LIBNAME).a
+pngtest-static: pngtest.o libpng.a
 	$(CC) -o pngtest-static $(CFLAGS) pngtest.o $(LDFLAGS_A)
 
 test: pngtest pngtest-static
@@ -87,42 +101,56 @@
 	./pngtest-static
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -sf $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -sf $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -sf $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -sf $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -sf $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -sf $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then mkdir \
+	$(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
 
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNMAJ)* \
diff --git a/scripts/makefile.macosx b/scripts/makefile.macosx
index 5acb765..d32a221 100644
--- a/scripts/makefile.macosx
+++ b/scripts/makefile.macosx
@@ -15,17 +15,31 @@
 ZLIBINC=../zlib
 
 CC=cc
-CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
-LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
-LDSHARED=cc -lz -dynamiclib -compatibility_version $(VER) -current_version $(VER)
 
 PNGMAJ = 0
-PNGMIN = 1.2.2
-VER = $(PNGMAJ).$(PNGMIN)
+PNGMIN = 1.2.3rc1
+PNGVER = $(PNGMAJ).$(PNGMIN)
+
+CFLAGS=-fno-common -I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
+LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz
+LDSHARED=cc -lz -dynamiclib -compatibility_version $(PNGVER) \
+-current_version $(PNGVER)
+
 LIBNAME=libpng12
 SHAREDLIB_POSTFIX=dylib
-LIBPATH=$(prefix)/lib
 INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 #RANLIB=echo
 RANLIB=ranlib
@@ -34,15 +48,18 @@
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
 	pngwtran.o pngmem.o pngerror.o pngpread.o
 
-all: libpng.a pngtest shared
+all: libpng.a pngtest shared libpng.pc
 
-shared: $(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX)
+shared: $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
+
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
 	$(RANLIB) $@
 
-$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX): $(OBJS)
+$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
 
 pngtest: pngtest.o libpng.a
@@ -53,51 +70,67 @@
 
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX)
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).$(SHAREDLIB_POSTFIX)
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).$(PNGMAJ)*.$(SHAREDLIB_POSTFIX)
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).$(SHAREDLIB_POSTFIX)
 	-@/bin/rm -f libpng.$(SHARED_POSTFIX)
 	-@/bin/rm -f libpng.3.$(SHARED_POSTFIX)
 	-@/bin/rm -f libpng.3.*.$(SHARED_POSTFIX)
-	cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
-	(cd $(LIBPATH); \
-	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
+	cp $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX)
+	(cd $(DESTDIR)$(LIBPATH); \
+	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
 	libpng.$(SHARED_POSTFIX); \
-	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
+	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
 	libpng.3.$(SHARED_POSTFIX); \
-	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) ]
+	ln -f -s $(LIBNAME).$(PNGVER).$(SHARED_POSTFIX) \
 	libpng.3.$(PNGMIN).$(SHARED_POSTFIX); \
 	ln -sf $(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
 	$(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX); \
 	ln -sf $(LIBNAME).$(PNGMAJ).$(SHAREDLIB_POSTFIX) \
 	$(LIBNAME).$(SHAREDLIB_POSTFIX))
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -sf libpng12.pc libpng.pc)
 
-install: install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png \
-	$(LIBNAME).$(VER).$(SHAREDLIB_POSTFIX) \
+	$(LIBNAME).$(PNGVER).$(SHAREDLIB_POSTFIX) \
 	$(LIBNAME).$(SHAREDLIB_POSTFIX)
 
 DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
diff --git a/scripts/makefile.mips b/scripts/makefile.mips
index 602a2f9..320b185 100644
--- a/scripts/makefile.mips
+++ b/scripts/makefile.mips
@@ -1,9 +1,22 @@
 # makefile for libpng
+# Copyright (C) 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
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 CC=cc
 CFLAGS=-I../zlib -O -systype sysv -DSYSV -w -Dmips
@@ -30,17 +43,18 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	-@rm -f $(prefix)/include/png.h
-	-@rm -f $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
-	cp libpng.a $(prefix)/lib
-	chmod 644 $(prefix)/lib/libpng.a
+	-@mkdir $(DESTDIR)$(INCPATH)
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
+	-@mkdir $(DESTDIR)$(LIBPATH)
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h $(DESTDIR)$(INCPATH)/libpng
+	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	cp libpng.a $(DESTDIR)$(LIBPATH)
+	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index 98be5df..b8ad349 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -13,7 +13,7 @@
 
 LIB=	png12
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.2
+SHLIB_MINOR=	1.2.3rc1
 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 348f838..fc1c6e4 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -13,7 +13,7 @@
 
 LIB=	png
 SHLIB_MAJOR=	3
-SHLIB_MINOR=	1.2.2
+SHLIB_MINOR=	1.2.3rc1
 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 4a080b5..852a198 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -7,7 +7,7 @@
 MANDIR= ${PREFIX}/man/cat
 
 SHLIB_MAJOR=	0
-SHLIB_MINOR=	1.2.2
+SHLIB_MINOR=	1.2.3rc1
 
 LIB=	png
 SRCS=	png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
@@ -65,6 +65,8 @@
 	${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
 		-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include/libpng
 	${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
+		-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
+	${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
 		-m ${NONBINMODE} ${DOCS} ${DESTDIR}${PREFIX}/share/doc/png
 
 .include <bsd.lib.mk>
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index fceeaa7..bc01201 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -1,6 +1,7 @@
 # makefile for SCO OSr5  ELF and Unixware 7 with Native cc
 # Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
 #   force ELF build dynamic linking, SONAME setting in lib and RPATH in app
+# Copyright (C) 2002 Glenn Randers-Pehrson
 # Copyright (C) 1998 Greg Roelofs
 # Copyright (C) 1996, 1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
@@ -25,12 +26,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include/libpng
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -43,12 +55,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -67,43 +82,60 @@
 
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	-@/bin/rm -f $(INCPATH)/png.h
-	-@/bin/rm -f $(INCPATH)/pngconf.h
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
+
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index eb7571e..94d4f3f 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -5,6 +5,18 @@
 
 # where make install puts libpng.a and png.h
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 # Where the zlib library and include files are located
 ZLIBLIB=/usr/local/lib32
@@ -24,12 +36,24 @@
 LDSHARED=CC $(ABI) -shared
 
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 # See "man dso" for info about shared objects
-LIBS=libpng12.so.$(PNGMAJ).$(PNGVER)
+LIBS=libpng12.so.$(PNGVER)
 LIBNAME=libpng12
+INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib32
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 RANLIB=echo
 #RANLIB=ranlib
@@ -38,12 +62,15 @@
 	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
+all: libpng.a $(LIBNAME).so.$(PNGVER) pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so.$(PNGVER): $(OBJS)
 	$(LDSHARED) -o $@ $(OBJS)
 	rm -f $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)
@@ -58,41 +85,57 @@
 
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index d201416..1c5c815 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -31,7 +31,7 @@
 # See "man dso" for info about shared objects
 LIBNAME=libpng12
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 
 RANLIB=echo
@@ -40,14 +40,28 @@
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
 #LIBPATH=$(prefix)/lib32
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 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 pngtest shared
+all: libpng.a pngtest shared libpng.pc
 
-shared: $(LIBNAME).so.$(PNGMAJ).$(PNGVER)
+shared: $(LIBNAME).so.$(PNGVER)
+
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@  $(OBJS)
@@ -66,41 +80,58 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
+
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png $(LIBNAME).so \
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index 6640ecd..69f8335 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -1,6 +1,7 @@
 # makefile for libpng on Solaris 9 (beta) with Forte cc
 # Updated by Chad Schrock for Solaris 9
 # Contributed by William L. Sebok, based on makefile.linux
+# Copyright (C) 2002 Glenn Randers-Pehrson
 # Copyright (C) 1998-2001 Greg Roelofs
 # Copyright (C) 1996-1997 Andreas Dilger
 # For conditions of distribution and use, see copyright notice in png.h
@@ -35,12 +36,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -53,12 +65,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -88,41 +103,58 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then mkdir \
+	$(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
+
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 1a857a3..a701078 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -32,12 +32,23 @@
 # read libpng.txt or png.h to see why PNGMAJ is 0.  You should not
 # have to change it.
 PNGMAJ = 0
-PNGMIN = 1.2.2
+PNGMIN = 1.2.3rc1
 PNGVER = $(PNGMAJ).$(PNGMIN)
 LIBNAME = libpng12
 
 INCPATH=$(prefix)/include
 LIBPATH=$(prefix)/lib
+MANPATH=$(prefix)/man
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
 	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
@@ -50,12 +61,15 @@
 .c.pic.o:
 	$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
 
-all: libpng.a $(LIBNAME).so pngtest
+all: libpng.a $(LIBNAME).so pngtest libpng.pc
 
 libpng.a: $(OBJS)
 	ar rc $@ $(OBJS)
 	$(RANLIB) $@
 
+libpng.pc:
+	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
+
 $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
 	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
 
@@ -85,41 +99,57 @@
 	./pngtest
 
 install-headers: png.h pngconf.h
-	-@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
-	-@if [ ! -d $(INCPATH)/$(LIBNAME) ]; then mkdir $(INCPATH)/$(LIBNAME); fi
-	cp png.h pngconf.h $(INCPATH)/$(LIBNAME)
-	chmod 644 $(INCPATH)/$(LIBNAME)/png.h $(INCPATH)/$(LIBNAME)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/png.h $(INCPATH)/pngconf.h
-	-@/bin/rm -f $(INCPATH)/libpng
-	ln -f -s $(INCPATH)/$(LIBNAME) $(INCPATH)/libpng
+	-@if [ ! -d $(DESTDIR)$(INCPATH) ]; then mkdir $(DESTDIR)$(INCPATH); fi
+	-@if [ ! -d $(DESTDIR)$(INCPATH)/$(LIBNAME) ]; then \
+	mkdir $(DESTDIR)$(INCPATH)/$(LIBNAME); fi
+	cp png.h pngconf.h $(DESTDIR)$(INCPATH)/$(LIBNAME)
+	chmod 644 $(DESTDIR)$(INCPATH)/$(LIBNAME)/png.h \
+	$(DESTDIR)$(INCPATH)/$(LIBNAME)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/png.h $(DESTDIR)$(INCPATH)/pngconf.h
+	-@/bin/rm -f $(DESTDIR)$(INCPATH)/libpng
+	(cd $(DESTDIR)$(INCPATH); ln -f -s $(LIBNAME) libpng; \
+	ln -f -s $(LIBNAME)/* .)
 
 install-static: install-headers libpng.a
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	cp libpng.a $(LIBPATH)/$(LIBNAME).a
-	chmod 644 $(LIBPATH)/$(LIBNAME).a
-	-@/bin/rm -f $(LIBPATH)/libpng.a
-	ln -f -s $(LIBPATH)/$(LIBNAME).a $(LIBPATH)/libpng.a
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	cp libpng.a $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	chmod 644 $(DESTDIR)$(LIBPATH)/$(LIBNAME).a
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.a
+	(cd $(DESTDIR)$(LIBPATH); ln -f -s $(LIBNAME).a libpng.a)
 
 install-shared: install-headers $(LIBNAME).so.$(PNGVER)
-	-@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
-	-@/bin/rm -f $(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* $(LIBPATH)/$(LIBNAME).so
-	-@/bin/rm -f $(LIBPATH)/libpng.so
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3
-	-@/bin/rm -f $(LIBPATH)/libpng.so.3.*
-	cp $(LIBNAME).so.$(PNGVER) $(LIBPATH)
-	chmod 755 $(LIBPATH)/$(LIBNAME).so.$(PNGVER)
-	(cd $(LIBPATH); \
+	-@if [ ! -d $(DESTDIR)$(LIBPATH) ]; then mkdir $(DESTDIR)$(LIBPATH); fi
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGMAJ)* \
+	$(DESTDIR)$(LIBPATH)/$(LIBNAME).so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3
+	-@/bin/rm -f $(DESTDIR)$(LIBPATH)/libpng.so.3.*
+	cp $(LIBNAME).so.$(PNGVER) $(DESTDIR)$(LIBPATH)
+	chmod 755 $(DESTDIR)$(LIBPATH)/$(LIBNAME).so.$(PNGVER)
+	(cd $(DESTDIR)$(LIBPATH); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so; \
 	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ))
-	-@if [ ! -d $(LIBPATH)/pkgconfig ]; then mkdir $(LIBPATH)/pkgconfig; fi
-	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
-	cp libpng.pc $(LIBPATH)/pkgconfig/libpng12.pc
-	chmod 644 $(LIBPATH)/pkgconfig/libpng12.pc
+	-@if [ ! -d $(DESTDIR)$(LIBPATH)/pkgconfig ]; then \
+	mkdir $(DESTDIR)$(LIBPATH)/pkgconfig; fi
+	cp libpng.pc $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	chmod 644 $(DESTDIR)$(LIBPATH)/pkgconfig/libpng12.pc
+	(cd $(DESTDIR)$(LIBPATH)/pkgconfig; ln -f -s libpng12.pc libpng.pc)
 
-install: install-static install-shared
+install-man: libpng.3 libpngpf.3 png.5
+	-@if [ ! -d $(MANPATH) ]; then mkdir $(MANPATH); fi
+	-@if [ ! -d $(MANPATH)/man3 ]; then mkdir $(MANPATH)/man3; fi
+	-@/bin/rm -f $(MANPATH)/man3/libpng.3
+	-@/bin/rm -f $(MANPATH)/man3/libpngpf.3
+	cp libpng.3 $(MANPATH)/man3
+	cp libpngpf.3 $(MANPATH)/man3
+	-@if [ ! -d $(MANPATH)/man5 ]; then mkdir $(MANPATH)/man5; fi
+	-@/bin/rm -f $(MANPATH)/man5/png.5
+	cp png.5 $(MANPATH)/man5
+
+install: install-static install-shared install-man
 
 clean:
 	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* \
diff --git a/scripts/makefile.std b/scripts/makefile.std
index 15e569a..85ac06c 100644
--- a/scripts/makefile.std
+++ b/scripts/makefile.std
@@ -1,9 +1,22 @@
 # makefile for libpng
+# Copyright (C) 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
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib
@@ -35,17 +48,18 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	-@rm -f $(prefix)/include/png.h
-	-@rm -f $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
-	cp libpng.a $(prefix)/lib
-	chmod 644 $(prefix)/lib/libpng.a
+	-@mkdir $(DESTDIR)$(INCPATH)
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
+	-@mkdir $(DESTDIR)$(LIBPATH)
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h $(DESTDIR)$(INCPATH)/libpng
+	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	cp libpng.a $(DESTDIR)$(LIBPATH)
+	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png
diff --git a/scripts/makefile.sunos b/scripts/makefile.sunos
index cdce372..5f29960 100644
--- a/scripts/makefile.sunos
+++ b/scripts/makefile.sunos
@@ -1,9 +1,22 @@
 # makefile for libpng
+# Copyright (C) 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
 prefix=/usr/local
+INCPATH=$(prefix)/include
+LIBPATH=$(prefix)/lib
+
+# override DESTDIR= on the make install command line to easily support
+# installing into a temporary location.  Example:
+#
+#    make install DESTDIR=/tmp/build/libpng
+#
+# If you're going to install into a temporary location
+# via DESTDIR, that location must already exist before
+# you execute make install.
+DESTDIR=
 
 # Where the zlib library and include files are located
 #ZLIBLIB=/usr/local/lib
@@ -39,17 +52,18 @@
 	./pngtest
 
 install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	-@rm -f $(prefix)/include/png.h
-	-@rm -f $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
-	cp libpng.a $(prefix)/lib
-	chmod 644 $(prefix)/lib/libpng.a
+	-@mkdir $(DESTDIR)$(INCPATH)
+	-@mkdir $(DESTDIR)$(INCPATH)/libpng
+	-@mkdir $(DESTDIR)$(LIBPATH)
+	-@rm -f $(DESTDIR)$(INCPATH)/png.h
+	-@rm -f $(DESTDIR)$(INCPATH)/pngconf.h
+	cp png.h $(DESTDIR)$(INCPATH)/libpng
+	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
+	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
+	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
+	cp libpng.a $(DESTDIR)$(LIBPATH)
+	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
 
 clean:
 	rm -f *.o libpng.a pngtest pngout.png
diff --git a/scripts/pngdef.pas b/scripts/pngdef.pas
index d22c308..72ba08f 100644
--- a/scripts/pngdef.pas
+++ b/scripts/pngdef.pas
@@ -7,8 +7,8 @@
 interface
 
 const
-  PNG_LIBPNG_VER_STRING = '1.2.2';
-  PNG_LIBPNG_VER        =  10202;
+  PNG_LIBPNG_VER_STRING = '1.2.3rc1';
+  PNG_LIBPNG_VER        =  10203;
 
 type
   png_uint_32 = Cardinal;
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index 35c904f..6f8a923 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
 ; PNG.LIB module definition file for OS/2
 ;----------------------------------------
 
-; Version 1.2.2
+; Version 1.2.3rc1
 
 LIBRARY		PNG
 DESCRIPTION	"PNG image compression library for OS/2"
@@ -197,8 +197,6 @@
   png_init_mmx_flags
 
 ; Added at version 1.2.2:
-  png_zalloc
-  png_zfree
   png_handle_as_unknown
 
 ; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
diff --git a/scripts/xmakefile.freebsd b/scripts/xmakefile.freebsd
deleted file mode 100644
index e07077d..0000000
--- a/scripts/xmakefile.freebsd
+++ /dev/null
@@ -1,77 +0,0 @@
-# makefile for libpng under FreeBSD
-# Copyright (C) 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
-prefix=/usr/local
-
-# Building shared libraries is handled by the FreeBSD external Makefile,
-# which uses this makefile.
-
-.if ${MACHINE_ARCH} == "i386"
-CFLAGS+= -I. -O -DPNG_USE_PNGGCCRD
-.else
-CFLAGS+= -I. -O -DPNG_USE_PNGGCCRD -DPNG_NO_ASSEMBLER_CODE
-.endif
-LDFLAGS+=-L. -lpng -lz -lm
-
-OBJS = 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 pnggccrd.o
-
-all: libpng.a pngtest
-
-libpng.a: $(OBJS)
-	ar rc $@  $(OBJS)
-	$(RANLIB) $@
-
-pngtest: pngtest.o libpng.a
-	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
-
-test: pngtest
-	./pngtest
-
-install: libpng.a
-	-@mkdir $(prefix)/include
-	-@mkdir $(prefix)/include/libpng
-	-@mkdir $(prefix)/lib
-	cp png.h $(prefix)/include
-	cp pngconf.h $(prefix)/include
-	chmod 644 $(prefix)/include/png.h
-	chmod 644 $(prefix)/include/pngconf.h
-	cp png.h $(prefix)/include/libpng
-	cp pngconf.h $(prefix)/include/libpng
-	chmod 644 $(prefix)/include/libpng/png.h
-	chmod 644 $(prefix)/include/libpng/pngconf.h
-	cp libpng.a $(prefix)/lib
-	chmod 644 $(prefix)/lib/libpng.a
-	$(RANLIB) $(prefix)/lib/libpng.a
-
-clean:
-	rm -f *.o libpng.a pngtest pngout.png
-
-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.
-
-png.o: png.h pngconf.h
-pngerror.o: png.h pngconf.h
-pngrio.o: png.h pngconf.h
-pngwio.o: png.h pngconf.h
-pngmem.o: png.h pngconf.h
-pngset.o: png.h pngconf.h
-pngget.o: png.h pngconf.h
-pngread.o: png.h pngconf.h
-pngrtran.o: png.h pngconf.h
-pngrutil.o: png.h pngconf.h
-pngtest.o: png.h pngconf.h
-pngtrans.o: png.h pngconf.h
-pngwrite.o: png.h pngconf.h
-pngwtran.o: png.h pngconf.h
-pngwutil.o: png.h pngconf.h
-pngpread.o: png.h pngconf.h
-pnggccrd.o: png.h pngconf.h
-