libtiff: v3.4beta035 release

From 773e971189d30b0603751845b31c66b62fc913a7 Mon Sep 17 00:00:00 2001
From: Sam Leffler <[EMAIL REDACTED]>
Date: Mon, 10 Jun 1996 22:24:41 +0100
Subject: [PATCH] v3.4beta035 release

---
 Makefile.in           | 19 +++++++--
 config.site           |  4 +-
 configure             | 32 ++++++++++----
 dist/tiff.alpha       |  2 +-
 dist/tiff.spec        | 17 +++-----
 html/Makefile.in      |  7 ++--
 libtiff/Makefile.in   | 14 ++++---
 libtiff/mkversion.c   | 97 ++++++++++++++++++++++++++++++++++++-------
 libtiff/tif_dirinfo.c |  5 ++-
 libtiff/tif_fax3.h    |  8 ++--
 libtiff/tiffio.h      |  4 +-
 tools/ras2tiff.c      |  4 +-
 tools/rgb2ycbcr.c     |  4 +-
 13 files changed, 156 insertions(+), 61 deletions(-)

diff --git a/Makefile.in b/Makefile.in
index 87999b7e..055c7f81 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,5 +1,5 @@
 #! smake
-#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.54 1996/05/21 18:59:50 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/Makefile.in,v 1.57 1996/06/10 22:24:41 sam Exp $
 #
 # @WARNING@
 #
@@ -35,13 +35,13 @@ SRCDIR	= @SRCDIR@
 # DATE:		@DATE@
 # TARGET:	@TARGET@
 # CCOMPILER:	@CCOMPILER@
-# CXXCOMPILER:	@CXXCOMPILER@
 #
 @SETMAKE@
 SHELL	= @SCRIPT_SH@
 NULL	=
 ECHO	= echo
 GENDIST	= ${TOOLROOT}/usr/sbin/gendist
+INSTALL	= @INSTALL@
 
 all default:
 	@if [ "@PORT@" = yes ]; then \
@@ -57,6 +57,11 @@ 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; \
+	else \
+	    true; \
+	fi
 
 clean:
 	@if [ "@PORT@" = yes ]; then \
@@ -76,14 +81,22 @@ clobber distclean: clean
 	rm -f tools/Makefile
 	rm -f man/Makefile
 	rm -f port/Makefile port/install.sh
+	rm -f html/Makefile
 
 #
 # The folllowing rule creates a binary distribution for IRIX.
 #
+installLink::
+	if [ @DIR_LIB@ != /usr/lib ]; then				\
+	    ${INSTALL} -idb tiff.sw.tools -F /usr/lib			\
+		-lns @DIR_LIB@/libtiff.@DSOSUF@ -O libtiff.@DSOSUF@;	\
+	else								\
+	    true;							\
+	fi
 product::
 	test -d dist || mkdir dist
 	rm -f dist/rawidb
-	SRC=`pwd` RAWIDB=`pwd`/dist/rawidb ${MAKE} install
+	SRC=`pwd` RAWIDB=`pwd`/dist/rawidb ${MAKE} install installLink
 	rm -f dist/idb
 	sort -u +4 dist/rawidb > dist/idb
 	${GENDIST} -v -dist dist -idb dist/idb \
diff --git a/config.site b/config.site
index 8bc38b91..eafd1da1 100644
--- a/config.site
+++ b/config.site
@@ -1,4 +1,4 @@
-# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.12 1996/02/22 18:16:44 sam Exp $
+# $Header: /usr/people/sam/tiff/RCS/config.site,v 1.13 1996/06/05 21:24:33 sam Exp $
 #
 # TIFF Software
 #
@@ -45,6 +45,7 @@
 #ZIP="no"			# yes|no configure Deflate support (see below)
 #LIBGL="auto"			# yes|no|auto configure IRIS GL-based tools
 #LIBIMAGE="auto"		# yes|no|auto configure SGI RGB image tools
+#HTML="no"			# yes|no install HTML documentation
 
 #
 # Directory parameters.
@@ -53,6 +54,7 @@
 #DIR_LIB="/usr/local/lib"		# directory for libraries
 #DIR_INC="/usr/local/include"		# directory for include files
 #DIR_MAN="/usr/local/man"		# directory for manual pages
+#DIR_HTML="/var/httpd/htdocs/tiff"	# directory for HTML documentation
 
 #
 # Configuring supporting libraries.
diff --git a/configure b/configure
index 9fe38292..92b2b5c4 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
 #!/bin/sh
-#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.49 1996/05/21 18:30:05 sam Exp $
+#	$Header: /usr/people/sam/tiff/RCS/configure,v 1.52 1996/06/10 20:48:14 sam Exp $
 #
 # Tag Image File Format (TIFF) Software
 #
@@ -47,6 +47,7 @@ SRCDIR=					# dir where source is located
 DIR_BIN=/usr/local/bin			# destination for applications
 DIR_LIB=/usr/local/lib			# destination for library
 DIR_INC=/usr/local/include		# destination for include files
+DIR_HTML=/var/httpd/htdocs/tiff		# destination for HTML files
 DIRS_LIBINC=				# dirs to search for ancillary includes
 DIR_JPEGLIB=				# dir for IJG -ljpeg
 DIR_GZLIB=				# dir for zlib -lgz
@@ -55,6 +56,7 @@ LIBCOPTS=				# library-specific C-compiler options
 JPEG=no					# configure JPEG support
 ZIP=no					# configure ZIP/Deflate support
 PORT=auto				# enable portability emulations
+HTML=no					# install HTML documentation
 LIBGL=auto				# auto-enable build of SGI -lgl apps
 LIBIMAGE=auto				# auto-enable build of SGI -limage apps
 MACHDEPLIBS=-lm				# machine-dependent libraries for apps
@@ -145,7 +147,7 @@ do
     -target|--target)		ac_prev=TARGET;;
     -target=*|--target=*)	TARGET="$ac_optarg" ;;
     -version|--version)
-	echo "This is TIFF configure $Revision: 1.49 $"
+	echo "This is TIFF configure $Revision: 1.52 $"
 	exit 0
 	;;
     -help|--help)		usage; exit 0;;
@@ -1081,6 +1083,7 @@ Note "Done checking system libraries."
 Note ""
 Note "Checking for Dynamic Shared Object (DSO) support."
 if [ "$DSO" = auto ]; then
+    DSO=no
     DSOSUF_VERSION=
     DSOLD='${LD}'
     TIFFLIBREF=
@@ -1131,6 +1134,12 @@ if [ "$DSO" = auto ]; then
 	DSO=NETBSD
 	TIFFLIBREF='-L${DEPTH}/libtiff -ltiff'
 	;;
+    *-freebsd*)
+	DSOSUF=so.${DIST_MAJOR}.0
+	LIBCOPTS='-fpic -fPIC'
+	DSO=FREEBSD
+	TIFFLIBREF='-L${DEPTH}/libtiff -ltiff'
+	;;
     *-linux*)
 	if [ -x /lib/libc.so.5 ]; then
 	    DSOSUF=so.${DIST_MAJOR}
@@ -1145,10 +1154,7 @@ if [ "$DSO" = auto ]; then
 	DSOOPTS='-shared'
 	DSO=OSF
 	;;
-    *)  DSO=no;;
     esac
-    test -z "$TIFFLIBREF" && TIFFLIBREF="\${DEPTH}/libtiff/libtiff.${DSOSUF}"
-    test -z "$DSOSUF_VERSION" && DSOSUF_VERSION=${DSOSUF}
 fi
 if [ "$DSO" != no ]; then
     JUNK="$JUNK t.${DSOSUF}"
@@ -1181,6 +1187,8 @@ if [ "$DSO" = no ]; then
     DSOSUF=a DSOOPTS= LIBCOPTS= 
     DSOSUF_VERSION=$DSOSUF
 fi
+test -z "$TIFFLIBREF" && TIFFLIBREF="\${DEPTH}/libtiff/libtiff.${DSOSUF}"
+test -z "$DSOSUF_VERSION" && DSOSUF_VERSION=${DSOSUF}
 Note "Done checking for DSO support."
 
 Note ""
@@ -1450,7 +1458,8 @@ 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] Manual page installation scheme:   $MANSCHEME
+[ 5] Directory for HTML documents:      $DIR_HTML
+[ 6] Manual page installation scheme:   $MANSCHEME
 
 EOF
 }
@@ -1470,7 +1479,10 @@ promptForParameter()
     4)	promptForNonNullStringParameter "$DIR_MAN" \
 	    "Directory to install manual pages";	DIR_MAN="$param"
 	;;
-    5)	promptForManPageScheme;;
+    5)	promptForNonNullStringParameter "$DIR_HTML" \
+	    "Directory to install HTML documents";	DIR_HTML="$param"
+	;;
+    6)	promptForManPageScheme;;
     esac
 }
 
@@ -1688,6 +1700,7 @@ cat>>confsed<<EOF
 /@DIR_BIN@/s;;${DIR_BIN};g
 /@DIR_JPEGLIB@/s;;`relativize ${DIR_JPEGLIB}`;g
 /@DIR_GZLIB@/s;;`relativize ${DIR_GZLIB}`;g
+/@DIR_HTML@/s;;${DIR_HTML};g
 /@DIR_INC@/s;;${DIR_INC};g
 /@DIR_LIB@/s;;${DIR_LIB};g
 /@DIR_MAN@/s;;${DIR_MAN};g
@@ -1702,6 +1715,7 @@ cat>>confsed<<EOF
 /@ENVOPTS@/s;;${ENVOPTS};g
 /@FILLORDER@/s;;${FILLORDER};g
 /@GCOPTS@/s;;${GCOPTS};g
+/@HTML@/s;;${HTML};g
 /@INSTALL@/s;;${INSTALL};g
 /@LIBJPEG@/s;;`relativize ${LIBJPEG}`;g
 /@LIBGL@/s;;${LIBGL};g
@@ -1797,10 +1811,10 @@ if [ $SRCDIR_IS_LIBTIFF != yes ] ; then
         tools/Makefile
         port/install.sh
         "
+    test $HTML = yes &&		CONF_FILES="$CONF_FILES html/Makefile"
+    test $PORT = yes &&		CONF_FILES="$CONF_FILES port/Makefile"
 fi
-
 SedConfigFiles $CONF_FILES
-test $PORT = yes &&		   SedConfigFiles port/Makefile
 
 Note "Done."
 
diff --git a/dist/tiff.alpha b/dist/tiff.alpha
index 18528f82..c6261fe1 100644
--- a/dist/tiff.alpha
+++ b/dist/tiff.alpha
@@ -1 +1 @@
-define ALPHA 034
+define ALPHA 035
diff --git a/dist/tiff.spec b/dist/tiff.spec
index a4efc953..9ff118f1 100644
--- a/dist/tiff.spec
+++ b/dist/tiff.spec
@@ -1,4 +1,4 @@
-#	$Header: /usr/people/sam/tiff/dist/RCS/tiff.spec,v 1.3 1996/01/10 19:37:41 sam Exp $
+#	$Header: /usr/people/sam/tiff/dist/RCS/tiff.spec,v 1.6 1996/06/10 21:43:11 sam Exp $
 #
 # TIFF Software
 #
@@ -40,11 +40,11 @@ product tiff
 	id	"${TIFF_NAME} Software"
 	version	"${CUR_VERS}"
 	subsys tools default
-	    id	"${TIFF_NAME} Tools"
+	    id	"${TIFF_NAME} Tools & Library DSO"
 	    exp	"tiff.sw.tools"
 	endsubsys
 	subsys dev
-	    id	"${TIFF_NAME} Library"
+	    id	"${TIFF_NAME} Developement Software"
 	    exp	"tiff.sw.dev"
 	endsubsys
     endimage
@@ -60,14 +60,9 @@ product tiff
 	    id	"${TIFF_NAME} Library Manual Pages"
 	    exp	"tiff.man.dev"
 	endsubsys
-    endimage
-
-    image html
-	id	"${TIFF_NAME} HTML Materials"
-	version	"${CUR_VERS}"
-	subsys sw
-	    id	"${TIFF_NAME} Software Distribution"
-	    exp	"tiff.html.sw"
+	subsys html
+	    id	"${TIFF_NAME} HTML Materials"
+	    exp	"tiff.man.html"
 	endsubsys
     endimage
 endproduct
diff --git a/html/Makefile.in b/html/Makefile.in
index 2011d692..c443ee71 100644
--- a/html/Makefile.in
+++ b/html/Makefile.in
@@ -1,4 +1,4 @@
-#	$Header: /usr/people/sam/tiff/html/RCS/Makefile.in,v 1.11 1996/05/21 18:57:50 sam Exp $
+#	$Header: /usr/people/sam/tiff/html/RCS/Makefile.in,v 1.13 1996/06/05 21:43:27 sam Exp $
 #
 # @WARNING@
 #
@@ -86,7 +86,6 @@ IMAGES=\
 	images/ring.gif		\
 	images/smallliz.jpg	\
 	images/strike.gif	\
-	images/strike.jpg	\
 	images/warning.gif	\
 	${NULL}
 TARGETS=
@@ -94,9 +93,9 @@ TARGETS=
 all:	${TARGETS}
 
 install: all
-	${INSTALL} -m 755 -dir -idb tiff.html.sw ${HTML} ${HTML}/images
+	${INSTALL} -m 755 -dir -idb tiff.man.html ${HTML} ${HTML}/images
 	for i in ${HTMLFILES} ${IMAGES}; do \
-	    ${INSTALL} -idb tiff.html.sw -m 444 -F ${HTML} \
+	    ${INSTALL} -idb tiff.man.html -m 444 -F ${HTML} \
 		-src ${SRCDIR}/$$i -O $$i; \
 	done
 
diff --git a/libtiff/Makefile.in b/libtiff/Makefile.in
index 65ef0e95..ede6b0b6 100644
--- a/libtiff/Makefile.in
+++ b/libtiff/Makefile.in
@@ -1,4 +1,4 @@
-#	$Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.in,v 1.36 1996/05/21 18:30:39 sam Exp $
+#	$Header: /usr/people/sam/tiff/libtiff/RCS/Makefile.in,v 1.38 1996/06/10 20:48:50 sam Exp $
 #
 # Tag Image File Format Library
 #
@@ -190,8 +190,8 @@ AIXdso: ${OBJS}
 	${AR} ${AROPTS} libtiff.@DSOSUF@ shr.o
 	rm -f shr.o
 	touch $@
-# NetBSD 1.1 and newer
-NETBSDdso: ${OBJS}
+# NetBSD 1.1 or FreeBSD
+NETBSDdso FREEBSDdso: ${OBJS}
 	@rm -f libtiff_pic.a
 	@${AR} cq libtiff_pic.a `lorder ${OBJS} | tsort -q`
 	${RANLIB} libtiff_pic.a
@@ -212,10 +212,12 @@ OSFdso: ${OBJS}
 ${OBJS}: ${SRCDIR}/tiffio.h ${SRCDIR}/tiff.h ${SRCDIR}/tif_dir.h
 ${OBJS}: ${SRCDIR}/tiffcomp.h ${SRCDIR}/tiffiop.h ${SRCDIR}/tiffconf.h
 
-version.h: ${SRCDIR}/mkversion.c
+ALPHA	= @ALPHAFILE@
+VERSION	= @VERSIONFILE@
+
+version.h: ${VERSION} ${ALPHA} ${SRCDIR}/mkversion.c
 	${CC} -o mkversion ${CFLAGS} ${SRCDIR}/mkversion.c
-	rm -f version.h; ./mkversion \
-	    @DIST_MAJOR@ @DIST_MINOR@ @DIST_ALPHA@ @DIST_TYPE@ version.h
+	rm -f version.h; ./mkversion -v ${VERSION} -a ${ALPHA} version.h
 tif_version.o: version.h
 
 #
diff --git a/libtiff/mkversion.c b/libtiff/mkversion.c
index f52665cb..674ba87a 100755
--- a/libtiff/mkversion.c
+++ b/libtiff/mkversion.c
@@ -1,4 +1,4 @@
-/* "$Header: /usr/people/sam/tiff/libtiff/RCS/mkversion.c,v 1.5 1996/05/21 18:19:48 sam Exp $ */
+/* "$Header: /usr/people/sam/tiff/libtiff/RCS/mkversion.c,v 1.4 1996/01/10 19:34:25 sam Exp $ */
 
 /*
  * Copyright (c) 1995-1996 Sam Leffler
@@ -25,39 +25,104 @@
  */
 
 /*
- * Generate a library version string.
+ * Generate a library version string for systems that
+ * do not have a shell (by default this is done with
+ * awk and echo from the Makefile).
  *
- * Syntax: mkversion major minor alpha type [outfile]
+ * This was written by Peter Greenham for Acorn systems.
+ *
+ * Syntax: mkversion [-v version-file] [-a alpha-file] [<outfile>]
  */
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 
+static void
+usage(void)
+{
+    fprintf(stderr,
+	"usage: mkversion [-v version-file] [-a alpha-file] [outfile]\n");
+    exit(-1);
+}
+
+static FILE*
+openFile(char* filename)
+{
+    FILE* fd = fopen(filename, "r");
+    if (fd == NULL) {
+	fprintf(stderr, "mkversion: %s: Could not open for reading.\n",
+	    filename);
+	exit(-1);
+    }
+    return (fd);
+}
+
 int
 main(int argc, char* argv[])
 {
+    char* versionFile = "../VERSION";
+    char* alphaFile = "../dist/tiff.alpha";
+    char version[128];
+    char alpha[128];
     FILE* fd;
+    char* cp;
 
-    if (argc != 5 && argc != 6) {
-	fprintf(stderr, "usage: %s major minor alpha type [outfile]\n",
-	    argv[0]);
+    argc--, argv++;
+    while (argc > 0 && argv[0][0] == '-') {
+	if (strcmp(argv[0], "-v") == 0) {
+	    if (argc < 1)
+		usage();
+	    argc--, argv++;
+	    versionFile = argv[0];
+	} else if (strcmp(argv[0], "-a") == 0) {
+	    if (argc < 1)
+		usage();
+	    argc--, argv++;
+	    alphaFile = argv[0];
+	} else
+	    usage();
+	argc--, argv++;
+    }
+    fd = openFile(versionFile);
+    if (fgets(version, sizeof (version)-1, fd) == NULL) {
+	fprintf(stderr, "mkversion: No version information in %s.\n",
+	    versionFile);
+	exit(-1);
+    }
+    cp = strchr(version, '\n');
+    if (cp)
+	*cp = '\0';
+    fclose(fd);
+    fd = openFile(alphaFile);
+    if (fgets(alpha, sizeof (alpha)-1, fd) == NULL) {
+	fprintf(stderr, "mkversion: No alpha information in %s.\n", alphaFile);
+	exit(-1);
+    }
+    fclose(fd);
+    cp = strchr(alpha, ' ');		/* skip to 3rd blank-separated field */
+    if (cp)
+	cp = strchr(cp+1, ' ');
+    if (cp) {				/* append alpha to version */
+	char* tp;
+	for (tp = strchr(version, '\0'), cp++; *tp = *cp; tp++, cp++)
+	    ;
+	if (tp[-1] == '\n')
+	    tp[-1] = '\0';
+    } else {
+	fprintf(stderr, "mkversion: Malformed alpha information in %s.\n",
+	    alphaFile);
 	exit(-1);
     }
-    if (argc == 6) {
-	fd = fopen(argv[5], "w");
+    if (argc > 0) {
+	fd = fopen(argv[0], "w");
 	if (fd == NULL) {
-	    fprintf(stderr, "%s: %s: Could not open for writing.\n",
-		argv[0], argv[5]);
+	    fprintf(stderr, "mkversion: %s: Could not open for writing.\n",
+		argv[0]);
 	    exit(-1);
 	}
     } else
 	fd = stdout;
-    if (strcmp(argv[4], "beta") == 0)
-	fprintf(fd, "#define VERSION \"LIBTIFF, Version %s.%sbeta%s\\n",
-	    argv[1], argv[2], argv[3]);
-    else
-	fprintf(fd, "#define VERSION \"LIBTIFF, Version %s.%s%s (alpha %s)\\n",
-	    argv[1], argv[2], argv[4], argv[3]);
+    fprintf(fd, "#define VERSION \"LIBTIFF, Version %s\\n", version);
     fprintf(fd, "Copyright (c) 1988-1996 Sam Leffler\\n");
     fprintf(fd, "Copyright (c) 1991-1996 Silicon Graphics, Inc.\"\n");
 
diff --git a/libtiff/tif_dirinfo.c b/libtiff/tif_dirinfo.c
index ac221244..436165f5 100644
--- a/libtiff/tif_dirinfo.c
+++ b/libtiff/tif_dirinfo.c
@@ -1,4 +1,4 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirinfo.c,v 1.37 1996/01/10 19:32:58 sam Exp $ */
+/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_dirinfo.c,v 1.38 1996/06/04 19:04:41 sam Exp $ */
 
 /*
  * Copyright (c) 1988-1996 Sam Leffler
@@ -232,7 +232,8 @@ tagCompare(const void* a, const void* b)
 {
 	const TIFFFieldInfo* ta = *(const TIFFFieldInfo**) a;
 	const TIFFFieldInfo* tb = *(const TIFFFieldInfo**) b;
- 	int c = ta->field_tag - tb->field_tag;
+	/* NB: width of c must match ttag_t */
+ 	int32 c = ta->field_tag - tb->field_tag;
 	return (c != 0 ? c : tb->field_type - ta->field_type);
 }
 
diff --git a/libtiff/tif_fax3.h b/libtiff/tif_fax3.h
index 9a9817c9..33d41760 100644
--- a/libtiff/tif_fax3.h
+++ b/libtiff/tif_fax3.h
@@ -1,4 +1,4 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_fax3.h,v 1.30 1996/05/10 14:45:33 sam Exp $ */
+/* $Header: /usr/people/sam/tiff/libtiff/RCS/tif_fax3.h,v 1.31 1996/06/04 19:04:41 sam Exp $ */
 
 /*
  * Copyright (c) 1990-1996 Sam Leffler
@@ -141,7 +141,7 @@ extern	const TIFFFaxTabEnt TIFFFaxBlackTable[];
 		goto eoflab;						\
 	    BitsAvail = (n);			/* pad with zeros */	\
 	} else {							\
-	    BitAcc |= bitmap[*cp++]<<BitsAvail;				\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
 	    BitsAvail += 8;						\
 	}								\
     }									\
@@ -155,13 +155,13 @@ extern	const TIFFFaxTabEnt TIFFFaxBlackTable[];
 		goto eoflab;						\
 	    BitsAvail = (n);			/* pad with zeros */	\
 	} else {							\
-	    BitAcc |= bitmap[*cp++]<<BitsAvail;				\
+	    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;		\
 	    if ((BitsAvail += 8) < (n)) {				\
 		if (EndOfData()) {					\
 		    /* NB: we know BitsAvail is non-zero here */	\
 		    BitsAvail = (n);		/* pad with zeros */	\
 		} else {						\
-		    BitAcc |= bitmap[*cp++]<<BitsAvail;			\
+		    BitAcc |= ((uint32) bitmap[*cp++])<<BitsAvail;	\
 		    BitsAvail += 8;					\
 		}							\
 	    }								\
diff --git a/libtiff/tiffio.h b/libtiff/tiffio.h
index e4a8d4ea..6bd776e7 100644
--- a/libtiff/tiffio.h
+++ b/libtiff/tiffio.h
@@ -1,4 +1,4 @@
-/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffio.h,v 1.93 1996/03/07 17:00:14 sam Exp $ */
+/* $Header: /usr/people/sam/tiff/libtiff/RCS/tiffio.h,v 1.94 1996/06/04 19:04:41 sam Exp $ */
 
 /*
  * Copyright (c) 1988-1996 Sam Leffler
@@ -65,7 +65,7 @@ typedef	struct tiff TIFF;
  * NB: toff_t is not off_t for many reasons; TIFFs max out at
  *     32-bit file offsets being the most important
  */
-typedef	unsigned int ttag_t;	/* directory tag */
+typedef	uint32 ttag_t;		/* directory tag */
 typedef	uint16 tdir_t;		/* directory index */
 typedef	uint16 tsample_t;	/* sample number */
 typedef	uint32 tstrip_t;	/* strip number */
diff --git a/tools/ras2tiff.c b/tools/ras2tiff.c
index a82e9101..467f0e85 100644
--- a/tools/ras2tiff.c
+++ b/tools/ras2tiff.c
@@ -1,4 +1,4 @@
-/* $Header: /usr/people/sam/tiff/tools/RCS/ras2tiff.c,v 1.29 1996/01/10 19:35:30 sam Exp $ */
+/* $Header: /usr/people/sam/tiff/tools/RCS/ras2tiff.c,v 1.30 1996/06/10 20:47:54 sam Exp $ */
 
 /*
  * Copyright (c) 1988-1996 Sam Leffler
@@ -32,7 +32,9 @@
 #include "rasterfile.h"
 #include "tiffio.h"
 
+#ifndef howmany
 #define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
 #define	streq(a,b)	(strcmp(a,b) == 0)
 #define	strneq(a,b,n)	(strncmp(a,b,n) == 0)
 
diff --git a/tools/rgb2ycbcr.c b/tools/rgb2ycbcr.c
index f034dc44..925efe0a 100644
--- a/tools/rgb2ycbcr.c
+++ b/tools/rgb2ycbcr.c
@@ -1,4 +1,4 @@
-/* $Header: /usr/people/sam/tiff/tools/RCS/rgb2ycbcr.c,v 1.27 1996/01/10 19:35:31 sam Exp $ */
+/* $Header: /usr/people/sam/tiff/tools/RCS/rgb2ycbcr.c,v 1.28 1996/06/10 20:47:54 sam Exp $ */
 
 /*
  * Copyright (c) 1991-1996 Sam Leffler
@@ -34,7 +34,9 @@
 #define	CopyField(tag, v) \
     if (TIFFGetField(in, tag, &v)) TIFFSetField(out, tag, v)
 
+#ifndef howmany
 #define	howmany(x, y)	(((x)+((y)-1))/(y))
+#endif
 #define	roundup(x, y)	(howmany(x,y)*((uint32)(y)))
 
 #define	LumaRed		ycbcrCoeffs[0]