libtiff: v3.4beta024 release

From 74a4ba75cb606153ec47c90b3bb625cf025821ae Mon Sep 17 00:00:00 2001
From: Sam Leffler <[EMAIL REDACTED]>
Date: Mon, 16 Oct 1995 22:50:32 +0100
Subject: [PATCH] v3.4beta024 release

---
 Makefile.in                        |  47 ++-
 config.site                        |  33 +-
 configure                          | 488 ++++++++++++++--------
 contrib/acorn/ReadMe               |  79 ++++
 contrib/acorn/SetVars              |   3 +
 contrib/acorn/convert              | 175 ++++++++
 contrib/acorn/install              | 124 ++++++
 contrib/vms/libtiff/tiffshraxp.opt | Bin 3221 -> 3221 bytes
 contrib/win32/README               | 111 +++++
 contrib/win32/dllshell.c           |  38 ++
 contrib/win32/libtiff.def          |  72 ++++
 dist/tiff.alpha                    |   2 +-
 html/Makefile.in                   |   3 +-
 html/build.html                    | 194 ++++++---
 html/contrib.html                  |  28 +-
 html/index.html                    |   4 +-
 html/internals.html                |  23 +-
 html/libtiff.html                  |   4 +-
 html/v3.4beta024.html              | 138 ++++++
 libtiff/Makefile.in                |  93 ++---
 libtiff/mkg3states.c               |  27 +-
 libtiff/mkversion.c                | 132 ++++++
 libtiff/tif_apple.c                |   4 +-
 libtiff/tif_codec.c                |   6 +-
 libtiff/tif_compress.c             |   4 +-
 libtiff/tif_fax3.c                 |  12 +-
 libtiff/tif_open.c                 |   4 +-
 libtiff/tif_packbits.c             |  11 +-
 libtiff/tif_print.c                |  14 +-
 libtiff/tif_strip.c                |   4 +-
 libtiff/tif_tile.c                 |   8 +-
 libtiff/tif_win32.c                | 295 +++++++++++++
 libtiff/tif_write.c                |  64 ++-
 libtiff/tiff.h                     |   8 +-
 libtiff/tiffcomp.h                 | 100 ++++-
 libtiff/tiffio.h                   |   6 +-
 libtiff/tiffiop.h                  |  19 +-
 man/Makefile.in                    | 237 +++++++----
 man/TIFFClose.3t                   |   8 +-
 man/TIFFError.3t                   |  14 +-
 man/TIFFFlush.3t                   |   8 +-
 man/TIFFGetField.3t                |  47 ++-
 man/TIFFOpen.3t                    |   8 +-
 man/TIFFPrintDirectory.3t          |   8 +-
 man/TIFFRGBAImage.3t               | 275 ++++++++++++
 man/TIFFReadDirectory.3t           |  19 +-
 man/TIFFReadEncodedStrip.3t        |  12 +-
 man/TIFFReadEncodedTile.3t         |  12 +-
 man/TIFFReadRGBAImage.3t           |  30 +-
 man/TIFFReadRawStrip.3t            |  13 +-
 man/TIFFReadRawTile.3t             |  17 +-
 man/TIFFReadScanline.3t            |  13 +-
 man/TIFFReadTile.3t                |   8 +-
 man/TIFFSetDirectory.3t            |  29 +-
 man/TIFFSetField.3t                |  46 +-
 man/TIFFWarning.3t                 |  12 +-
 man/TIFFWriteDirectory.3t          |   8 +-
 man/TIFFWriteEncodedStrip.3t       |  26 +-
 man/TIFFWriteEncodedTile.3t        |   8 +-
 man/TIFFWriteRawStrip.3t           |  21 +-
 man/TIFFWriteRawTile.3t            |   8 +-
 man/TIFFWriteScanline.3t           |   8 +-
 man/TIFFbuffer.3t                  |  77 ++++
 man/TIFFcodec.3t                   |  73 ++++
 man/TIFFmemory.3t                  |  84 ++++
 man/{query.3t => TIFFquery.3t}     |  55 ++-
 man/{size.3t => TIFFsize.3t}       |  60 +--
 man/{strip.3t => TIFFstrip.3t}     |  55 ++-
 man/{swab.3t => TIFFswab.3t}       |   8 +-
 man/{tile.3t => TIFFtile.3t}       |  61 ++-
 man/fax2tiff.1                     |   6 +-
 man/gif2tiff.1                     |  12 +-
 man/{intro.3t => libtiff.3t}       | 197 ++++++---
 man/pal2rgb.1                      |  10 +-
 man/ppm2tiff.1                     |  17 +-
 man/ras2tiff.1                     |  15 +-
 man/rgb2ycbcr.1                    |  83 ++--
 man/sgi2tiff.1                     |  12 +-
 man/thumbnail.1                    |   6 +-
 man/tiff2bw.1                      |  16 +-
 man/tiff2ps.1                      |  18 +-
 man/tiffcmp.1                      |   6 +-
 man/tiffcp.1                       |  13 +-
 man/tiffdither.1                   |  11 +-
 man/tiffdump.1                     |  10 +-
 man/tiffgt.1                       | 115 ++++-
 man/tiffinfo.1                     |   8 +-
 man/tiffmedian.1                   |  11 +-
 man/tiffsplit.1                    |   6 +-
 man/tiffsv.1                       |  13 +-
 port/Makefile.in                   |   6 +-
 port/strcasecmp.c                  |  17 +-
 tools/Makefile.in                  |  14 +-
 tools/fax2ps.c                     |  43 +-
 tools/fax2tiff.c                   |  17 +-
 tools/gif2tiff.c                   |   6 +-
 tools/pal2rgb.c                    |   6 +-
 tools/ppm2tiff.c                   |   8 +-
 tools/ras2tiff.c                   |   6 +-
 tools/rgb2ycbcr.c                  |   6 +-
 tools/sgi2tiff.c                   |  57 ++-
 tools/sgigt.c                      |  13 +-
 tools/sgisv.c                      |  13 +-
 tools/thumbnail.c                  |  89 ++--
 tools/tiff2bw.c                    |   6 +-
 tools/tiff2ps.c                    | 647 ++++++++++++++++++++++++-----
 tools/tiffcmp.c                    |  17 +-
 tools/tiffcp.c                     |  89 ++--
 tools/tiffdither.c                 |   6 +-
 tools/tiffdump.c                   |  32 +-
 tools/tiffinfo.c                   |   6 +-
 tools/tiffmedian.c                 |   6 +-
 tools/tiffsplit.c                  |   6 +-
 113 files changed, 4180 insertions(+), 1266 deletions(-)
 create mode 100755 contrib/acorn/ReadMe
 create mode 100755 contrib/acorn/SetVars
 create mode 100755 contrib/acorn/convert
 create mode 100755 contrib/acorn/install
 create mode 100644 contrib/win32/README
 create mode 100644 contrib/win32/dllshell.c
 create mode 100644 contrib/win32/libtiff.def
 create mode 100644 html/v3.4beta024.html
 create mode 100755 libtiff/mkversion.c
 create mode 100644 libtiff/tif_win32.c
 create mode 100644 man/TIFFRGBAImage.3t
 create mode 100644 man/TIFFbuffer.3t
 create mode 100644 man/TIFFcodec.3t
 create mode 100644 man/TIFFmemory.3t
 rename man/{query.3t => TIFFquery.3t} (73%)
 rename man/{size.3t => TIFFsize.3t} (51%)
 rename man/{strip.3t => TIFFstrip.3t} (57%)
 rename man/{swab.3t => TIFFswab.3t} (91%)
 rename man/{tile.3t => TIFFtile.3t} (66%)
 rename man/{intro.3t => libtiff.3t} (67%)

diff --git a/Makefile.in b/Makefile.in
index 71867cf3..b1dd3b3f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
 #! smake
-#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.25 1995/07/19 01:53:48 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.37 1995/10/16 22:01:20 sam Exp $
 #
 # @WARNING@
 #
@@ -27,9 +27,8 @@
 # LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE 
 # OF THIS SOFTWARE.
 #
-DEPTH	= .
 
-SRCDIR	= ${DEPTH}/@SRCDIR@
+SRCDIR	= @SRCDIR@
 
 #
 # VERSION:	@VERSION@
@@ -42,6 +41,7 @@ SRCDIR	= ${DEPTH}/@SRCDIR@
 SHELL	= /bin/sh
 NULL	=
 ECHO	= echo
+GENDIST	= ${TOOLROOT}/usr/sbin/gendist
 
 all default:
 	@if [ "@PORT@" = yes ]; then \
@@ -50,17 +50,11 @@ all default:
 	@${ECHO} "= "libtiff; cd libtiff; ${MAKE}
 	@${ECHO} "= "tools; cd tools; ${MAKE}
 	@${ECHO} "= "man; cd man; ${MAKE}
-	@if [ "@HTML@" = yes ]; then \
-	    ${ECHO} "= "html; cd html; ${MAKE}; \
-	fi
 
 install:
 	@${ECHO} "= "libtiff; cd libtiff; ${MAKE} install
 	@${ECHO} "= "tools; cd tools; ${MAKE} install
 	@${ECHO} "= "man; cd man; ${MAKE} install
-	@if [ "@HTML@" = yes ]; then \
-	    ${ECHO} "= "html; cd html; ${MAKE} install; \
-	fi
 
 clean:
 	@if [ "@PORT@" = yes ]; then \
@@ -69,14 +63,11 @@ clean:
 	@${ECHO} "= "libtiff; cd libtiff; ${MAKE} clean
 	@${ECHO} "= "tools; cd tools; ${MAKE} clean
 	@${ECHO} "= "man; cd man; ${MAKE} clean
-	@if [ "@HTML@" = yes ]; then \
-	    ${ECHO} "= "html; cd html; ${MAKE} clean; \
-	fi
 #	-cd contrib/dbs; ${MAKE} clean
 #	-cd contrib/dbs/xtiff; ${MAKE} clean
 
 clobber distclean: clean
-	rm -f Makefile port.h config.log
+	rm -f Makefile libtiff/port.h config.log
 	rm -f libtiff/Makefile
 	rm -f tools/Makefile
 	rm -f man/Makefile
@@ -86,11 +77,13 @@ clobber distclean: clean
 # The folllowing rule creates a binary distribution for IRIX.
 #
 product::
+	test -d dist || mkdir dist
 	rm -f dist/rawidb
 	SRC=`pwd` RAWIDB=`pwd`/dist/rawidb ${MAKE} install
 	rm -f dist/idb
 	sort -u +4 dist/rawidb > dist/idb
-	gendist -v -dist dist -idb dist/idb -sbase `pwd` -spec ${SRCDIR}/dist/tiff.spec
+	${GENDIST} -v -dist dist -idb dist/idb \
+	    -sbase `pwd` -spec ${SRCDIR}/dist/tiff.spec
 
 #
 # These rules are used to create the source distribution images
@@ -124,6 +117,7 @@ TIFFFILES=\
 	    libtiff/tiffiop.h			\
 	    libtiff/mkg3states.c		\
 	    libtiff/mkspans.c			\
+	    libtiff/mkversion.c			\
 	    libtiff/tif_apple.c			\
 	    libtiff/tif_atari.c			\
 	    libtiff/tif_aux.c			\
@@ -160,6 +154,7 @@ TIFFFILES=\
 	    libtiff/tif_vms.c			\
 	    libtiff/tif_warning.c		\
 	    libtiff/tif_win3.c			\
+	    libtiff/tif_win32.c			\
 	    libtiff/tif_write.c			\
 	    libtiff/tif_zip.c			\
 	port/Makefile.in			\
@@ -227,6 +222,7 @@ TIFFFILES=\
 	    man/TIFFReadRawTile.3t		\
 	    man/TIFFReadScanline.3t		\
 	    man/TIFFReadTile.3t			\
+	    man/TIFFRGBAImage.3t		\
 	    man/TIFFSetDirectory.3t		\
 	    man/TIFFSetField.3t			\
 	    man/TIFFWarning.3t			\
@@ -236,12 +232,15 @@ TIFFFILES=\
 	    man/TIFFWriteRawStrip.3t		\
 	    man/TIFFWriteRawTile.3t		\
 	    man/TIFFWriteScanline.3t		\
-	    man/intro.3t			\
-	    man/query.3t			\
-	    man/size.3t				\
-	    man/strip.3t			\
-	    man/swab.3t				\
-	    man/tile.3t				\
+	    man/libtiff.3t			\
+	    man/TIFFbuffer.3t			\
+	    man/TIFFcodec.3t			\
+	    man/TIFFmemory.3t			\
+	    man/TIFFquery.3t			\
+	    man/TIFFsize.3t			\
+	    man/TIFFstrip.3t			\
+	    man/TIFFswab.3t			\
+	    man/TIFFtile.3t			\
 	html/Makefile.in			\
 	    html/bugs.html			\
 	    html/build.html			\
@@ -255,6 +254,7 @@ TIFFFILES=\
 	    html/misc.html			\
 	    html/support.html			\
 	    html/tools.html			\
+	    html/v3.4beta024.html		\
 	    html/v3.4beta018.html		\
 	    html/v3.4beta016.html		\
 	    html/v3.4beta007.html		\
@@ -299,6 +299,8 @@ CONTRIBFILES=\
 	    contrib/vms/tools/makevms.com	\
 	contrib/tags				\
 	contrib/mac-mpw				\
+	contrib/acorn				\
+	contrib/win32				\
 	${NULL}
 DISTFILES=\
 	${TIFFFILES}				\
@@ -309,20 +311,19 @@ DISTFILES=\
 	${NULL}
 
 CONFIG=\
-	-with-CC=ncc \
+	-with-CC=cc \
 	-with-GCOPTS=" " \
 	-with-JPEG=yes \
 	-with-DIR_JPEG=../src/jpeg-5a \
 	-with-ZIP=yes \
 	-with-DIR_LIBGZ=../src/zlib \
-	-with-HTML \
 	${NULL}
 
 rcsclean:
 	rcsclean ${TIFFFILES} && co ${TIFFFILES}
 
 alpha:
-	(cd ${SRCDIR}/dist; sh newalpha; sh newversion)
+	(cd ${SRCDIR}/dist; sh newversion)
 	-${MAKE} clean
 	${MAKE} alpha.stamp
 	${SRCDIR}/configure ${CONFIG}
diff --git a/config.site b/config.site
index 15d0760e..a680210e 100644
--- a/config.site
+++ b/config.site
@@ -1,4 +1,4 @@
-# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.5 1995/07/17 14:53:35 sam Exp $
+# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.7 1995/10/10 01:03:54 sam Exp $
 #
 # TIFF Software
 #
@@ -40,8 +40,7 @@
 #
 # Package controls.
 #
-#DSO="auto"			# yes|no|auto configure DSO support
-#HTML="no"			# yes|no configure HTML documentation
+#DSO="auto"			# auto|IRIX configure DSO support for system
 #JPEG="no"			# yes|no configure JPEG support
 #ZIP="no"			# yes|no configure Deflate support
 #LIBGL="auto"			# yes|no|auto configure IRIS GL-based tools
@@ -61,31 +60,23 @@
 # NB: JPEG support requires release 5 or later of the IJG code,
 #     which you can find on the Internet at ftp.uu.net:/graphics/jpeg/.
 #
-#DIR_JPEG="../jpeg"			# directory for JPEG include files
-#LIBJPEG="-L \${JPEGDIR} -ljpeg"	# JPEG library to load
+#DIRS_LIBINC="$DIRS_LIBINC ../jpeg"	# directory for JPEG include files
+#LIBJPEG="-L ../jpeg -ljpeg"		# JPEG library to load
 
 #
 # Deflate-specific parameters; used when Deflate support is enabled.
 #
-# NB: Deflate support requires version 0.92 or later of the libgz
-#     library written by Jean-loup Gailly and Mark Adler.  The library
-#     was last found at ftp://ftp.uu.net/graphics/png/code/zlib-0.93.tar.gz.
+# NB: Deflate support requires version 0.92 or later of the zlib
+#     library written by Jean-loup Gailly and Mark Adler.  Starting
+#     with about 0.95 the library is called libz.a (previously it was
+#     libgz.a).  The library was last found at
 #
-#DIR_LIBGZ="../zlib"			# directory for libgz include files
-#LIBGZ="-L \${ZIPDIR} -lgz"		# libgz library to load
-
-#
-# HTML-specific parameters; only used when the
-# HTML package is configured for installation.
+#        ftp://ftp.uu.net/graphics/png/code/zlib-0.93.tar.gz
 #
-# Note that ``PATH''s are the virtual pathnames used
-# in forming URLs; they are not directory pathnames
-# in the filesystem.
+#     Look for it also at ftp://ftp.uu.net/pub/archiving/zip/zlib.
 #
-#DIR_HTML="/var/httpd/htdocs/tiff"	# directory for HTML documentation
-#DIR_CGI="/var/httpd/cgi-bin"		# directory for CGI scripts
-#HTMLPATH="/tiff"			# virtual path to HTML materials
-#CGIPATH="/cgi-bin"			# virtual path to CGI scripts
+#DIRS_LIBINC="$DIRS_LIBINC ../zlib"	# directory for zlib include files
+#LIBGZ="-L ../zlib -lz"			# libgz library to load
 
 #
 # Miscellaneous parameters.
diff --git a/configure b/configure
index b4f5891c..6211ecef 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.15 1995/07/17 14:57:08 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.26 1995/10/15 23:39:31 sam Exp $
 #
 # Tag Image File Format (TIFF) Software
 #
@@ -39,14 +39,10 @@
 DIR_BIN=/usr/local/bin
 DIR_LIB=/usr/local/lib
 DIR_INC=/usr/local/include
-DIR_HTML=/var/httpd/htdocs/tiff
-DIR_CGI=/var/httpd/cgi-bin
-DIR_JPEG=.
-DIR_LIBGZ=.
-HTMLPATH=/tiff
-CGIPATH=/cgi-bin
+DIRS_LIBINC=
+DIR_JPEGLIB=
+DIR_GZLIB=
 DSO=auto
-HTML=no
 JPEG=no
 ZIP=no
 PORT=auto
@@ -141,7 +137,7 @@ do
     -target|--target)		ac_prev=TARGET;;
     -target=*|--target=*)	TARGET="$ac_optarg" ;;
     -version|--version)
-	echo "This is TIFF configure $Revision: 1.15 $"
+	echo "This is TIFF configure $Revision: 1.26 $"
 	exit 0
 	;;
     -help|--help)		usage; exit 0;;
@@ -192,6 +188,14 @@ if [ ! -r $SRCDIR/VERSION ]; then
 fi
 SRCDIR=`echo "$SRCDIR" | sed 's;\([^/]\)/*$;\1;'`
 
+if [ -r ${SRCDIR}/tif_version.c ] ; then
+    SRCDIR_IS_LIBTIFF=yes
+    PORDOTH=port.h
+else
+    SRCDIR_IS_LIBTIFF=no
+    PORTDOTH=libtiff/port.h
+fi
+
 #
 # Descriptor usage:
 # 1: ???
@@ -207,7 +211,14 @@ else
 fi
 exec 5>./config.log			# compiler messages and the like
 
-VERSION="v`cat $SRCDIR/VERSION``awk '{print $3}' $SRCDIR/dist/tiff.alpha`"
+if [ -r $SRCDIR/tiff.alpha ] ; then
+    VERSIONFILE=$SRCDIR/VERSION
+    ALPHAFILE=$SRCDIR/tiff.alpha
+else
+    VERSIONFILE=$SRCDIR/VERSION
+    ALPHAFILE=$SRCDIR/dist/tiff.alpha
+fi
+VERSION="v`cat $VERSIONFILE``awk '{print $3}' $ALPHAFILE`"
 DATE=`date`
 
 Note()
@@ -237,6 +248,18 @@ elif [ -f $SRCDIR/config.local ]; then
     . $SRCDIR/config.local
 fi
 
+#
+# Emulate old-style settups...
+#
+test -z "${DIR_JPEG:-}"  || {
+    DIRS_LIBINC="${DIRS_LIBINC} ${DIR_JPEG}"
+    DIR_JPEGLIB=${DIR_JPEG}
+}
+test -z "${DIR_LIBGZ:-}" || {
+    DIRS_LIBINC="${DIRS_LIBINC} ${DIR_LIBGZ}"
+    DIR_GZLIB=${DIR_LIBGZ}
+}
+
 identifyTarget()
 {
     random=`date | awk '{print $4}' | sed -e 's/.*://'` 2>/dev/null
@@ -270,6 +293,16 @@ else
     Note "Warning, I don't seem to have the GNU config.sub script to canonicalize"
     Note "your target specification; this may cause problems later on..."
 fi
+if [ -z "${FILLORDER:-}" ]; then
+    #
+    # Host bit order within a word.
+    #
+    case $TARGET in
+    mips-dec-*)	FILLORDER=LSB2MSB;;
+    i[345]86-*)	FILLORDER=LSB2MSB;;
+    *)		FILLORDER=MSB2LSB;;
+    esac
+fi
 
 cat 1>&5 <<EOF
 This file contains any messages produced by compilers while
@@ -327,6 +360,26 @@ findAppDef()
     echo $def
 }
 
+#
+# Find the full pathname of a header file; in search-path $DIRS_LIBINC
+#
+findHeader()
+{
+    case "$1" in
+    /*) echo "$1"; return ;;
+    esac
+    for i in ${DIRS_LIBINC}; do
+	test -r $i/$1 && {
+	    if [ $SRCDIR_IS_LIBTIFF = yes ]; then
+		echo "$i/$1";
+	    else
+		echo "../$i/$1";
+	    fi
+	    return;
+	}
+    done
+}
+
 #
 # Locate a C and C++ compiler and verify they work and
 # satisfy our needs (using assorted heuristics).
@@ -367,7 +420,7 @@ EOF
 #
 isGNU()
 {
-    $1 -E xgnu.c 2>&5 | egrep yes >/dev/null 2>&1
+    ($1 -E xgnu.c 2>&5 | egrep yes) >/dev/null 2>&1
 }
 
 #
@@ -377,41 +430,49 @@ cat>dummy.c<<EOF
 main(int argc, char* argv) { exit(0); }
 EOF
 
-: ${ENVOPTS=}
-CCOMPILER=
-for i in $CC gcc cc ncc dcc xlc c89 gcc2; do
-    if isGNU $i; then
+checkCompiler()
+{
+    compiler=$1
+    if isGNU $compiler; then
 	ISGCC=yes
     else
 	ISGCC=no
     fi
     #
     # Guess special options needed to get an
-    # ANSI C compiler and/or similar.  Should
-    # probably be combined with above checks
-    # so we only select an ANSI C compiler.
+    # ANSI C compiler and/or similar.  Must
+    # be combined with above checks so we only
+    # select an ANSI C compiler.
     #
-    if [ -z "$ENVOPTS" ]; then
+    if [ -z "${ENVOPTS:-}" ]; then
 	case $ISGCC-$TARGET in
-	no-*-irix*)	C_ANSI=-ansi;;
+	no-*-irix*)	C_ANSI="-ansi";;
 	no-*-hp*)	C_ANSI="-Aa -D_HPUX_SOURCE -Dhpux";;
 	no-*-apollo-*)	C_ANSI="-A nansi";;
+	no-*-aix*)	C_ANSI="-Dunix -qlanglvl=ansi -qsrcmsg";;
 	*-sco*)		C_ANSI="-Dsco";;
-	*-aix*)		C_ANSI="-Dunix -qlanglvl=ansi -qsrcmsg" ;;
 	esac
     else
 	C_ANSI="$ENVOPTS"
     fi
     $RM dummy dummy.o
-    ($i -o dummy $C_ANSI dummy.c) >/dev/null 2>&5 && {
-	CC=$i;
-	CCOMPILER=`findApp $i $PATH`
-	if [ -z "$ENVOPTS" ]; then
-	    ENVOPTS="$C_ANSI"
-	fi
-	break;
+    ($compiler -o dummy ${C_ANSI} dummy.c) >/dev/null 2>&5 && {
+	CC=$compiler;
+	test -z "${CCOMPILER:-}" && CCOMPILER=`findApp $compiler $PATH`
+	test -z "${ENVOPTS:-}"   && ENVOPTS="${C_ANSI:-}"
+	return 0
     }
-done
+    return 1
+}
+
+if [ -z "${CC:-}" ]; then
+    CCOMPILER=
+    for i in gcc cc ncc dcc xlc c89 gcc2; do
+	checkCompiler $i && break
+    done
+else
+    checkCompiler $CC
+fi
 if [ -z "$CCOMPILER" ]; then
     cat<<EOF
 Cannot locate a working ANSI C compiler.
@@ -422,20 +483,21 @@ and rerun this script.
 
 If command line options are required for ANSI C compilation, set the
 variable ENVOPTS to these options and rerun this script.
-
-If you are trying to use GNU gcc, but you do not have version 2.6.1
-or newer, then you must update your compiler (and probably libg++ as
-well) before you can compile this software.  Consult the documentation
-for information about obtaining an up-to-date version of gcc.
 EOF
-    boom
-fi
+        boom
+    fi
 Note "Using $CCOMPILER for a C compiler (set CC to override)."
 
 test "$ENVOPTS" && {
     Note "Using $ENVOPTS to get the appropriate compilation environment."
 }
 
+if [ ${ISGCC} = yes ] ; then
+    GCCversion="`${CCOMPILER} -v 2>&1 | \
+	sed -n -e '/version/s/.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)/\1.\2.\3/p'`"
+fi
+
+
 CheckForGandO()
 {
    f=$1
@@ -445,17 +507,20 @@ CheckForGandO()
     return 0
 }
 
-if [ -z "$GCOPTS" ]; then
-    $CCOMPILER $ENVOPTS -g -c dummy.c >/dev/null 2>&5 && {
+if [ -z "${GCOPTS:-}" ]; then
+    if $CCOMPILER $ENVOPTS -g -c dummy.c >/dev/null 2>&5; then
 	Note "Looks like $CCOMPILER supports the -g option."
-	if $CCOMPILER $ENVOPTS $GCOPTS -c -g -O dummy.c >t 2>&1 && CheckForGandO t; then
-	    GCOPTS="$GCOPTS -g"
+	if $CCOMPILER $ENVOPTS -c -g -O dummy.c >t 2>&1 && CheckForGandO t; then
+	    GCOPTS="-g"
 	else
 	    Note "... but not together with the -O option, not using it."
+	    GCOPTS=
 	fi
-    }
+    else
+	GCOPTS=
+    fi
 fi
-if [ "$GCOPTS" ]; then
+if [ ! -z "${GCOPTS}" ]; then
     Note "Using \"$GCOPTS\" for C compiler options."
 fi
 
@@ -493,7 +558,7 @@ fi
 # in the Makefiles.  If not, we add an explicit define
 # for places where recursive calls are made.
 #
-if [ -z "$SETMAKE" ]; then
+if [ -z "${SETMAKE:-}" ]; then
 M=
 eval `(cat<<'EOF'
 all:
@@ -508,13 +573,13 @@ EOF
     fi
 fi
 
-test "$AR" || AR=`findApp ar $PATH`
+test -z "${AR:-}" && AR=`findApp ar $PATH`
 if [ -z "$AR" ]; then
     Note "*** Warning, could not locate a suitable ar command; using a default."
     AR=ar
 fi
-test "$AROPTS" || AROPTS=rc
-test "$RANLIB" || RANLIB=`findApp ranlib $PATH`
+test -z "${AROPTS:-}" && AROPTS=rc
+test -z "${RANLIB:-}" && RANLIB=`findApp ranlib $PATH`
 if [ -z "$RANLIB" ]; then
     Note "Warning, no ranlib, assuming it's not needed."
     RANLIB=":"
@@ -770,7 +835,7 @@ EOF
 CheckForBigEndian()
 {
     echo 'main() { int one = 1; char* cp = (char*)&one; exit(*cp!=0); }'>t.c
-    runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c" >/dev/null
+    runMake t "t:; ${CCOMPILER} ${ENVOPTS} t.c">/dev/null && ./a.out
 }
 
 #
@@ -783,17 +848,10 @@ CheckPortDotH()
     {
 	param=`grep "$1:" $2 | sed -e 's/.*:[ 	]*\([^ 	]*\).*/\1/'`
     }
-    getConfigTag TARGET port.h; target="$param"
-    getConfigTag CCOMPILER port.h; ccompiler="$param"
+    getConfigTag TARGET $PORTDOTH; target="$param"
+    getConfigTag CCOMPILER $PORTDOTH; ccompiler="$param"
     CCOMP=$CCOMPILER
     if [ $ISGCC = yes ]; then
-	getGCCVersion()
-	{
-	    eval `$1 -v 2>&1 | \
-		sed -n -e '/version/s/.* \([0-9]*\)\.\([0-9]*\).\([0-9]*\)/GCCdist=\1;GCCmajor=\2;GCCminor=\3/p'`
-	    GCCversion="${GCCdist}.${GCCmajor}.${GCCminor}"
-	}
-	getGCCVersion $CCOMPILER
 	CCOMP="${CCOMP}-${GCCversion}"
     fi
     test "$target" = "$TARGET" && test "$ccompiler" = "$CCOMP"
@@ -805,12 +863,11 @@ CheckPortDotH()
 BuildPortDotH()
 {
     Note ""
-    Note "Creating port.h with necessary definitions."
+    Note "Creating $PORTDOTH with necessary definitions."
 
     (EmitCPlusPlusPrologue _PORT_
 
     CheckForIncludeFile sys/types.h && echo '#include <sys/types.h>'
-    CheckVarDecl mode_t 'typedef int mode_t;' sys/types.h stdlib.h
     CheckVarDecl off_t 'typedef long off_t;' sys/types.h stdlib.h
     CheckVarDecl size_t 'typedef unsigned size_t;' sys/types.h stdlib.h
     CheckVarDecl u_char 'typedef unsigned char u_char;' sys/types.h
@@ -818,16 +875,6 @@ BuildPortDotH()
     CheckVarDecl u_int 'typedef unsigned int u_int;' sys/types.h
     CheckVarDecl u_long 'typedef unsigned long u_long;' sys/types.h
 
-    if [ -z "$FILLORDER" ]; then
-	#
-	# Host bit order within a word.
-	#
-	case $TARGET in
-	mips-dec-*)	FILLORDER=LSB2MSB;;
-	i[345]86-*)	FILLORDER=LSB2MSB;;
-	*)		FILLORDER=MSB2LSB;;
-	esac
-    fi
     echo "#define HOST_FILLORDER FILLORDER_${FILLORDER}"
     CPU=`echo $TARGET | sed 's/-.*//'`
     Note "... using $FILLORDER bit order for your $CPU cpu"
@@ -865,7 +912,7 @@ BuildPortDotH()
     echo 'typedef double dblparam_t;'
 	Note "... using double for promoted floating point parameters"
 
-    if [ -z "$INLINE" ]; then
+    if [ -z "${INLINE:-}" ]; then
 	if [ $ISGCC = yes ]; then
 	    echo '#ifdef __STRICT_ANSI__'
 	    echo '#define	INLINE	__inline__'
@@ -884,62 +931,55 @@ BuildPortDotH()
 
     echo '#define GLOBALDATA(TYPE,NAME)	extern TYPE NAME'
 
-    CheckFuncDecl strcasecmp \
-	'extern int strcasecmp(const char*, const char*);' string.h
     CheckFuncDecl memset 'extern void* memset(void*, int, size_t);' string.h
     CheckFuncDecl floor 'extern double floor(double);' math.h
     CheckFuncDecl ceil 'extern double ceil(double);' math.h
     CheckFuncDecl exp 'extern double exp(double);' math.h
     CheckFuncDecl pow 'extern double pow(double);' math.h
-    CheckFuncDecl unlink 'extern int unlink(const char*);' unistd.h
     CheckFuncDecl read 'extern int read(int, const void*, unsigned int);' unistd.h
     CheckFuncDecl malloc 'extern void* malloc(size_t);' stdlib.h
     CheckFuncDecl realloc 'extern void* realloc(void*, size_t);' stdlib.h
     CheckFuncDecl free 'extern void free(void*);' stdlib.h
-    CheckFuncDecl strtoul \
-	'extern unsigned long strtoul(const char*, char**, int);' stdlib.h
-    #
-    # unistd.h is for sco3.2v4.[0-2] and GNU libc (yech!)
-    #
-    CheckFuncDecl getopt \
-	'extern int getopt(int, char* const*, const char*);' stdlib.h unistd.h
-    CheckVarDecl 'char.*optarg' 'extern char* optarg;' stdlib.h unistd.h
-    CheckVarDecl 'int.*opterr' 'extern int opterr;' stdlib.h unistd.h
-    CheckVarDecl 'int.*optind' 'extern int optind;' stdlib.h unistd.h
     EmitCPlusPlusEpilogue
     )>xport.h
-    mv xport.h port.h; chmod 444 port.h
-    Note "Done creating port.h."
+    mv xport.h $PORTDOTH; chmod 444 $PORTDOTH
+    Note "Done creating $PORTDOTH."
 }
 
-if test -f port.h && CheckPortDotH; then
+if test -f $PORTDOTH && CheckPortDotH; then
     Note ""
-    Note "Using previously created port.h."
+    Note "Using previously created $PORTDOTH."
 else
-    $RM xport.h t.c a.out port.h
+    $RM xport.h t.c a.out $PORTDOTH
     BuildPortDotH
 fi
 
-Note ""
-Note "Checking system libraries for functionality to emulate."
+if [ "$PORT" = auto ]; then
+    Note ""
+    Note "Checking system libraries for functionality to emulate."
 
-FUNCS="
-    strcasecmp
-    strtoul
-    getopt
-"
+    FUNCS="
+        strcasecmp
+        strtoul
+        getopt
+    "
 
-for i in $FUNCS; do
-    CheckForFunc $i || {
-	Note "... emulate $i"
-	PORTFUNCS="$PORTFUNCS $i.c"
-    }
-done
-if [ "$PORTFUNCS" ]; then
-    LIBPORT='${PORT}/libport.a'
-    PORT=yes
-else
-    PORT=no
+    for i in $FUNCS; do
+        CheckForFunc $i || {
+            Note "... emulate $i"
+            PORTFUNCS="${PORTFUNCS:-} $i.c"
+        }
+    done
+    if [ "${PORTFUNCS:-}" ]; then
+        LIBPORT='../port/libport.a'
+        PORT=yes
+    else
+        PORT=no
+    fi
+fi
+if [ $PORT != yes ] ; then
+   LIBPORT=
+   PORTFUNCS=
 fi
 Note "Done checking system libraries."
 
@@ -947,10 +987,18 @@ Note ""
 Note "Checking for Dynamic Shared Object (DSO) support."
 if [ "$DSO" = auto ]; then
     case $TARGET in
+    *-irix5.2*)
+	if (findApp rld /lib:/usr/lib:$PATH) >/dev/null 2>&1; then
+	    DSOSUF=so
+	    DSOOPTS='-shared -rdata_shared -check_registry ${SRCDIR}/port/irix/so_locations -quickstart_info'
+	    DSO=IRIX52
+	fi
+	;;
     *-irix*)
 	if (findApp rld /lib:/usr/lib:$PATH) >/dev/null 2>&1; then
 	    DSOSUF=so
-	    DSOOPTS='-shared -rdata_shared -check_registry ${SRCDIR}/${PORT}/irix/so_locations -quickstart_info'
+	    DSOOPTS='-shared -rdata_shared -check_registry ${SRCDIR}/port/irix/so_locations -quickstart_info'
+	    DSO=IRIX
 	fi
 	;;
     *)  DSO=no;;
@@ -973,24 +1021,19 @@ EOF
 	"t: t.o; ${CCOMPILER} ${ENVOPTS} ${DSOOPTS} -o t.${DSOSUF} t.o" >/dev/null
     }
     if CheckCCDSO; then
-	Note "Looks like your system supports SVR4-style DSOs."
-	DSO=yes
+	Note "Looks like your system supports $DSO-style DSOs."
     else
 	cat 1>&4 <<EOF
-Looks like your system supports SVR4-style DSOs...
+Looks like your system supports $DSO-style DSOs...
 ... sigh, but $CCOMPILER does not support DSOs in the expected way.
 EOF
 	DSO=no
     fi
 fi
-Note "Done checking for DSO support."
-
 if [ "$DSO" = no ]; then
-    MAKEDSOINCLUDE='#'
     DSOSUF=a DSOOPTS= 
-else
-    MAKEDSOINCLUDE="$MAKEINCLUDE"
 fi
+Note "Done checking for DSO support."
 
 Note ""
 if [ "$LIBIMAGE" = auto ]; then
@@ -1017,15 +1060,15 @@ Note "Selecting programs used during installation."
 #
 # Miscellaneous ``little'' programs.
 #
-test "$CHMOD"	|| CHMOD=`findAppDef chmod $PATH chmod`
-test "$LN"	|| LN=`findAppDef ln $PATH ln`
-test "$SED"	|| SED=`findAppDef sed $PATH sed`
-test "$STRIP"	|| STRIP=`findAppDef strip $PATH strip`
+test -z "${CHMOD:-}"	&& CHMOD=`findAppDef chmod $PATH chmod`
+test -z "${LN:-}"	&& LN=`findAppDef ln $PATH ln`
+test -z "${SED:-}"	&& SED=`findAppDef sed $PATH sed`
+test -z "${STRIP:-}"	&& STRIP=`findAppDef strip $PATH strip`
 
 #
 # Check if mv -f is supported
 #
-if [ -z "$MV_F" ]; then
+if [ -z "${MV_F:-}" ]; then
     $RM t.c; echo "">t.c
     if mv -f t.c t.o; then
 	Note "Looks like mv supports the -f option to force a move."
@@ -1040,7 +1083,7 @@ fi
 #
 # Check if ln -s creates a symbolic link.
 #
-if [ -z "$LN_S" ]; then
+if [ -z "${LN_S:-}" ]; then
     $RM t.c; $LN -s foo t.c && LN_S=-s
 fi
 if [ -n "$LN_S" ]; then
@@ -1053,10 +1096,10 @@ fi
 #
 # Pick install mechanism.
 #
-if [ -z "$INSTALL" ]; then
+if [ -z "${INSTALL:-}" ]; then
     case $TARGET in
     *-irix*)	INSTALL=`findApp install /sbin:$PATH`;;
-    *)		INSTALL='${SHELL} ${PORT}/install.sh';;
+    *)		INSTALL='${SHELL} ../port/install.sh';;
     esac
 fi
 
@@ -1095,7 +1138,7 @@ bitchExecutable()
 # 4. Whether or not the FlexFAX ``F'' suffix must be
 #    stripped for pages to be found (only for 4F pages).
 #
-if [ -z "$DIR_MAN" ]; then
+if [ -z "${DIR_MAN:-}" ]; then
     MANPATH="
 	$MANPATH
 	/usr/local/man
@@ -1109,7 +1152,7 @@ if [ -z "$DIR_MAN" ]; then
     test -z "$DIR_MAN" && DIR_MAN=/usr/local/man
 fi
 Note "Looks like manual pages go in $DIR_MAN."
-if [ -z "$MANSCHEME" ]; then
+if [ -z "${MANSCHEME:-}" ]; then
     case $TARGET in
     *-bsdi*|*-netbsd*)		MANSCHEME=bsd-nroff-gzip-0.gz;;
     *-freebsd*)			MANSCHEME=bsd-source-cat;;
@@ -1173,7 +1216,7 @@ fi
 promptForNonNullStringParameter()
 {
     x="" val="$1" desc="$2"
-    while [ -z "$x" ]; do
+    while [ -z "${x:-}" ]; do
 	prompt "$desc [$val]?"; read x
 	if [ "$x" ]; then
 	    # strip leading and trailing white space
@@ -1188,7 +1231,7 @@ promptForNonNullStringParameter()
 promptForManPageScheme()
 {
     x=""
-    while [ -z "$x" ]; do
+    while [ -z "${x:-}" ]; do
 	prompt "Manual page installation scheme [$MANSCHEME]?"; read x
 	if [ "$x" ]; then
 	    # strip leading and trailing white space
@@ -1258,8 +1301,7 @@ TIFF configuration parameters are:
 [ 2] Directory for libraries:           $DIR_LIB
 [ 3] Directory for include files:       $DIR_INC
 [ 4] Directory for manual pages:        $DIR_MAN
-[ 5] Directory for HTML documentation:  $DIR_HTML
-[ 6] Manual page installation scheme:   $MANSCHEME
+[ 5] Manual page installation scheme:   $MANSCHEME
 
 EOF
 }
@@ -1279,13 +1321,66 @@ promptForParameter()
     4)	promptForNonNullStringParameter "$DIR_MAN" \
 	    "Directory to install manual pages";	DIR_MAN="$param"
 	;;
-    5)	promptForNonNullStringParameter "$DIR_HTML" \
-	    "Directory to install HTML documentation";	DIR_HTML="$param"
-	;;
-    6)	promptForManPageScheme;;
+    5)	promptForManPageScheme;;
     esac
 }
 
+checkJPEG()
+{
+    if [ "${JPEG}" = yes ]; then
+	test "`findHeader jpeglib.h`" || {
+	    cat<<EOF
+
+The set of libtiff include directories,
+
+    DIRS_LIBINC=${DIRS_LIBINC}
+
+does not seem to be setup correctly; "jpeglib.h" was not found.
+This must be corrected if the JPEG support is to be enabled.
+Either fix the pathname or disable the JPEG support.
+
+EOF
+	}
+        test -d "${DIR_JPEGLIB}" || {
+            cat<<EOF
+
+The JPEG library directory, ${DIR_JPEGLIB}, does not seem to exist.
+This must be corrected if the JPEG support is to be enabled.
+Either fix the pathname or disable the JPEG support.
+
+EOF
+        }
+    fi
+}
+
+checkZIP()
+{
+    if [ "${ZIP}" = yes ]; then
+	test "`findHeader zlib.h`" || {
+            cat<<EOF
+
+The set of libtiff include directories,
+
+    DIRS_LIBINC=${DIRS_LIBINC}
+
+does not seem to be setup correctly; "zlib.h" was not found.
+This must be corrected if the (G)ZIP support is to be enabled.
+Either fix the pathname or disable the (G)ZIP support.
+
+EOF
+        }
+        test -d "${DIR_GZLIB}" || {
+            cat<<EOF
+
+The libgz source directory, ${DIR_GZLIB}, does not seem to be setup
+correctly.  This must be corrected if the ZIP support is to be enabled.
+Either fix the pathname or disable the ZIP support.
+
+EOF
+        }
+    fi
+}
+
 if [ $QUIET = no ]; then
     ok=skip
     while [ "$ok" != y ] && [ "$ok" != yes ]; do
@@ -1307,29 +1402

(Patch may be truncated, please check the link at the top of this post.)