diff options
author | Even Rouault <even.rouault@spatialys.com> | 2022-12-10 14:26:54 +0100 |
---|---|---|
committer | Even Rouault <even.rouault@spatialys.com> | 2022-12-10 16:21:44 +0100 |
commit | 2e7640c966e5c3bf32455d2e6212b6a5be6603d8 (patch) | |
tree | f17d8c2a86e6615604461ff789359012326dc1fb | |
parent | 234971dfd8c2031c331acb5385a0bfd0b3bfc4bf (diff) | |
download | libtiff-git-2e7640c966e5c3bf32455d2e6212b6a5be6603d8.tar.gz |
tiffvers.h: add TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, TIFFLIB_MICRO_VERSION defines
Also add a TIFFLIB_AT_LEAST() macro
-rw-r--r-- | Makefile.am | 2 | ||||
-rw-r--r-- | RELEASE-DATE | 2 | ||||
-rw-r--r-- | libtiff/tiffvers.h | 16 | ||||
-rw-r--r-- | libtiff/tiffvers.h.in | 14 | ||||
-rw-r--r-- | test/test_open_options.c | 25 |
5 files changed, 56 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am index 254ab7d9..2f07eec7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -65,7 +65,7 @@ SUBDIRS = port libtiff tools build contrib test doc release: (rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE) (rm -f $(top_srcdir)/VERSION && echo $(LIBTIFF_VERSION) > $(top_srcdir)/VERSION) - (rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h) + (rm -f $(top_srcdir)/libtiff/tiffvers.h && sed 's,LIBTIFF_VERSION,$(LIBTIFF_VERSION),;s,LIBTIFF_RELEASE_DATE,$(LIBTIFF_RELEASE_DATE),;s,LIBTIFF_MAJOR_VERSION,$(LIBTIFF_MAJOR_VERSION),;s,LIBTIFF_MINOR_VERSION,$(LIBTIFF_MINOR_VERSION),;s,LIBTIFF_MICRO_VERSION,$(LIBTIFF_MICRO_VERSION),' $(top_srcdir)/libtiff/tiffvers.h.in > $(top_srcdir)/libtiff/tiffvers.h) pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libtiff-4.pc diff --git a/RELEASE-DATE b/RELEASE-DATE index 6f787fd2..039ae27f 100644 --- a/RELEASE-DATE +++ b/RELEASE-DATE @@ -1 +1 @@ -20221209 +20221210 diff --git a/libtiff/tiffvers.h b/libtiff/tiffvers.h index ca958869..b59e3c51 100644 --- a/libtiff/tiffvers.h +++ b/libtiff/tiffvers.h @@ -6,4 +6,18 @@ * version checking should be done based on the * string returned by TIFFGetVersion. */ -#define TIFFLIB_VERSION 20221209 +#define TIFFLIB_VERSION 20221210 + +/* The following defines have been added in 4.5.0 */ +#define TIFFLIB_MAJOR_VERSION 4 +#define TIFFLIB_MINOR_VERSION 5 +#define TIFFLIB_MICRO_VERSION 0 + +/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is + * greater or equal to major.minor.micro + */ +#define TIFFLIB_AT_LEAST(major, minor, micro) \ + (TIFFLIB_MAJOR_VERSION > (major) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \ + TIFFLIB_MICRO_VERSION >= (micro))) diff --git a/libtiff/tiffvers.h.in b/libtiff/tiffvers.h.in index 48ec0eb8..48fec9b1 100644 --- a/libtiff/tiffvers.h.in +++ b/libtiff/tiffvers.h.in @@ -7,3 +7,17 @@ * string returned by TIFFGetVersion. */ #define TIFFLIB_VERSION LIBTIFF_RELEASE_DATE + +/* The following defines have been added in 4.5.0 */ +#define TIFFLIB_MAJOR_VERSION LIBTIFF_MAJOR_VERSION +#define TIFFLIB_MINOR_VERSION LIBTIFF_MINOR_VERSION +#define TIFFLIB_MICRO_VERSION LIBTIFF_MICRO_VERSION + +/* Macro added in 4.5.0. Returns TRUE if the current libtiff version is + * greater or equal to major.minor.micro + */ +#define TIFFLIB_AT_LEAST(major, minor, micro) \ + (TIFFLIB_MAJOR_VERSION > (major) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION > (minor)) || \ + (TIFFLIB_MAJOR_VERSION == (major) && TIFFLIB_MINOR_VERSION == (minor) && \ + TIFFLIB_MICRO_VERSION >= (micro))) diff --git a/test/test_open_options.c b/test/test_open_options.c index aef99e89..136adb37 100644 --- a/test/test_open_options.c +++ b/test/test_open_options.c @@ -43,6 +43,31 @@ #define ERROR_STRING_SIZE 1024 +/* Test TIFFLIB_AT_LEAST() macro */ +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, \ + TIFFLIB_MICRO_VERSION) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if !TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION - 1, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION + 1, 0, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION + 1, 0) +#error "TIFFLIB_AT_LEAST broken" +#endif +#if TIFFLIB_AT_LEAST(TIFFLIB_MAJOR_VERSION, TIFFLIB_MINOR_VERSION, \ + TIFFLIB_MICRO_VERSION + 1) +#error "TIFFLIB_AT_LEAST broken" +#endif + typedef struct MyErrorHandlerUserDataStruct { char *buffer; |