libtiff: cmake fixes

From d20f7eff759fa16d58df04f200c53d745612f03a Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 21 Oct 2023 23:33:32 +0300
Subject: [PATCH] cmake fixes

---
 CMakeLists.txt                | 10 +++++-----
 libtiff/tif_config.h.cmake.in |  8 ++++----
 libtiff/tiffconf.h.cmake.in   |  2 +-
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52a511a0..73b716f1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -203,7 +203,7 @@ else()
 endif()
 
 # Find libm, if available
-if(NOT MINGW)
+if(NOT WIN32)
   find_library(M_LIBRARY m)
 endif()
 
@@ -314,7 +314,7 @@ if(SIZEOF_SIGNED_LONG EQUAL 8)
   set(TIFF_INT64_FORMAT "%ld")
 elseif(SIZEOF_SIGNED_LONG_LONG EQUAL 8)
   set(TIFF_INT64_T "signed long long")
-  if (MINGW)
+  if (WIN32)
     set(TIFF_INT64_FORMAT "%I64d")
   else()
     set(TIFF_INT64_FORMAT "%lld")
@@ -326,7 +326,7 @@ if(SIZEOF_UNSIGNED_LONG EQUAL 8)
   set(TIFF_UINT64_FORMAT "%lu")
 elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL 8)
   set(TIFF_UINT64_T "unsigned long long")
-  if (MINGW)
+  if (WIN32)
     set(TIFF_UINT64_FORMAT "%I64u")
   else()
     set(TIFF_UINT64_FORMAT "%llu")
@@ -346,7 +346,7 @@ elseif(SIZEOF_UNSIGNED_LONG EQUAL SIZEOF_SIZE_T)
 elseif(SIZEOF_UNSIGNED_LONG_LONG EQUAL SIZEOF_SIZE_T)
   set(TIFF_SIZE_T "unsigned long long")
   set(TIFF_SSIZE_T "signed long long")
-  if (MINGW)
+  if (WIN32)
     set(TIFF_SIZE_FORMAT "%I64u")
     set(TIFF_SSIZE_FORMAT "%I64d")
   else()
@@ -706,7 +706,7 @@ endif()
 
 # Libraries required by libtiff
 set(TIFF_LIBRARY_DEPS)
-if(NOT MINGW AND M_LIBRARY)
+if(NOT WIN32 AND M_LIBRARY)
   list(APPEND TIFF_LIBRARY_DEPS "m")
 endif()
 if(ZLIB_LIBRARIES)
diff --git a/libtiff/tif_config.h.cmake.in b/libtiff/tif_config.h.cmake.in
index 24144603..06be6527 100644
--- a/libtiff/tif_config.h.cmake.in
+++ b/libtiff/tif_config.h.cmake.in
@@ -108,7 +108,7 @@
 #cmakedefine JPEG_DUAL_MODE_8_12 1
 
 /* 12bit libjpeg primary include file with path */
-#define LIBJPEG_12_PATH @LIBJPEG_12_PATH@
+#cmakedefine LIBJPEG_12_PATH @LIBJPEG_12_PATH@
 
 /* Support LZMA2 compression */
 #cmakedefine LZMA_SUPPORT 1
@@ -149,6 +149,9 @@
 /* The size of `signed long long', as computed by sizeof. */
 #define SIZEOF_SIGNED_LONG_LONG @SIZEOF_SIGNED_LONG_LONG@
 
+/* The size of `size_t', as computed by sizeof. */
+#define SIZEOF_SIZE_T @SIZEOF_SIZE_T@
+
 /* The size of `unsigned char *', as computed by sizeof. */
 #define SIZEOF_UNSIGNED_CHAR_P @SIZEOF_UNSIGNED_CHAR_P@
 
@@ -161,9 +164,6 @@
 /* The size of `unsigned long long', as computed by sizeof. */
 #define SIZEOF_UNSIGNED_LONG_LONG @SIZEOF_UNSIGNED_LONG_LONG@
 
-/* The size of `unsigned short', as computed by sizeof. */
-#define SIZEOF_UNSIGNED_SHORT @SIZEOF_UNSIGNED_SHORT@
-
 /* Default size of the strip in bytes (when strip chopping enabled) */
 #define STRIP_SIZE_DEFAULT @STRIP_SIZE_DEFAULT@
 
diff --git a/libtiff/tiffconf.h.cmake.in b/libtiff/tiffconf.h.cmake.in
index 9b4b0328..0eb54139 100644
--- a/libtiff/tiffconf.h.cmake.in
+++ b/libtiff/tiffconf.h.cmake.in
@@ -92,7 +92,7 @@
 
 /* Support strip chopping (whether or not to convert single-strip uncompressed
    images to mutiple strips of ~8Kb to reduce memory usage) */
-#cmakedefine STRIPCHOP_DEFAULT 1
+#cmakedefine STRIPCHOP_DEFAULT TIFF_STRIPCHOP
 
 /* Enable SubIFD tag (330) support */
 #cmakedefine SUBIFD_SUPPORT 1