From fd82c68d1886c65306875f1dd159d41fddd558ee Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Fri, 29 Jul 2022 13:13:34 +0200
Subject: [PATCH] tif_jpeg.c: allow to pass -DEXPECTED_JPEG_LIB_VERSION=number
to do optional compile-time version check
---
libtiff/tif_jpeg.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libtiff/tif_jpeg.c b/libtiff/tif_jpeg.c
index ba94a1c1..c8acc9f6 100644
--- a/libtiff/tif_jpeg.c
+++ b/libtiff/tif_jpeg.c
@@ -112,6 +112,13 @@ typedef unsigned char boolean;
#include "jerror.h"
#include "jpeglib.h"
+/* Do optional compile-time version check */
+#if defined(EXPECTED_JPEG_LIB_VERSION) && !defined(LIBJPEG_12_PATH)
+#if EXPECTED_JPEG_LIB_VERSION != JPEG_LIB_VERSION
+#error EXPECTED_JPEG_LIB_VERSION != JPEG_LIB_VERSION
+#endif
+#endif
+
/*
* Do we want to do special processing suitable for when JSAMPLE is a
* 16bit value?