Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-f.b-one.net (mx-f.one.com [91.198.169.53])
	by mail9.b-one.net (Postfix) with ESMTP id 9684D40011B
	for <info@awaresystems.be>; Thu, 18 Dec 2008 05:56:52 +0100 (CET)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=6 tests=[none]
X-Greylist: from auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-f.b-one.net (Postfix) with ESMTP id 02B182800088
	for <info@awaresystems.be>; Thu, 18 Dec 2008 05:56:51 +0100 (CET)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 2E90A1CEE7844;
	Thu, 18 Dec 2008 04:56:47 +0000 (UTC)
Received: from sasl.smtp.pobox.com (a-sasl-quonix.sasl.smtp.pobox.com
	[208.72.237.25])
	by lists.maptools.org (Postfix) with ESMTP id 239A21D0E4107
	for <tiff@lists.maptools.org>; Thu, 18 Dec 2008 04:56:45 +0000 (UTC)
Received: from localhost.localdomain (unknown [127.0.0.1])
	by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTP id 77A2D1A88C
	for <tiff@lists.maptools.org>; Wed, 17 Dec 2008 23:56:41 -0500 (EST)
Received: from [192.168.2.4] (unknown [67.47.28.121]) (using TLSv1 with
	cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate
	requested)
	by b-sasl-quonix.sasl.smtp.pobox.com (Postfix) with ESMTPSA id
	30D571A88B for
	<tiff@lists.maptools.org>; Wed, 17 Dec 2008 23:56:37 -0500 (EST)
Message-ID: <4949D804.5010103@pobox.com>
Date: Wed, 17 Dec 2008 23:56:36 -0500
From: Frank Warmerdam <warmerdam@pobox.com>
User-Agent: Thunderbird 2.0.0.6 (X11/20071022)
MIME-Version: 1.0
To: TIFF mailing list <tiff@lists.maptools.org>
X-Pobox-Relay-ID: 42A362A0-CCC0-11DD-B81A-F83E113D384A-06493634!a-sasl-quonix.pobox.com
Subject: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Folks,

In ancient times, the only version information available to applications
building against libtiff was:

#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.0beta3\nCopyright (c) 
1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."

Circa 2000 or so I added:

/*
  * This define can be used in code that requires
  * compilation-related definitions specific to a
  * version or versions of the library.  Runtime
  * version checking should be done based on the
  * string returned by TIFFGetVersion.
  */
#define TIFFLIB_VERSION 20081217

in tiffvers.h.  This is the date of release.

However, as we split the 3.9 and 4.0 branches a "time stamp" no longer
clearly defines the libtiff version well.  So I propose to add:

/*
  * This define contains the library version number encode as
  * two digits each for major, minor and point.  So, for instance,
  * 3.9.8 would be 030908.  This define was only introduced in libtiff4.
  */
#define TIFFLIB_RELEASE 040000

This macro should make it easy to do checks on features from different
versions of libtiff.  An example (whether TIFFUnsetField() is available)
is demonstrated here:

#if TIFFLIB_VERSION >= 20081217 \
     && defined(TIFFLIB_RELEASE) && TIFFLIB_RELEASE >= 040000
         TIFFUnsetField( poGDS->hTIFF, TIFFTAG_COLORMAP );
#else
         CPLDebug( "GTiff",
                   "TIFFUnsetField() not supported, colormap may not be 
cleared." );
#endif

Does the addition of TIFFLIB_RELEASE seem ok to folks?  Any suggestions
or caveats?  Hmm, I just discovered that tiffvers.h is autogenerated
by "make release" in the main libtiff makefile.  Does anyone know why
such a mechanism is used?  It seems like it might be rather involved to
cause it to generate the TIFFLIB_VERSION macro.  I'm inclined to revert
this to a manual process described in HOWTO-RELEASE unless someone
sees a reason for it to be as complicated as it is now.

Best regards,


-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
