1diff a/third_party/libtiff/tiffiop.h b/third_party/libtiff/tiffiop.h 2--- a/third_party/libtiff/tiffiop.h 3+++ b/third_party/libtiff/tiffiop.h 4@@ -28,7 +28,7 @@ 5 * ``Library-private'' definitions. 6 */ 7 8-#include "tif_config.h" 9+#include "tiffconf.h" 10 11 #ifdef HAVE_FCNTL_H 12 # include <fcntl.h> 13diff a/third_party/libtiff/tif_jpeg.c b/third_party/libtiff/tif_jpeg.c 14--- a/third_party/libtiff/tif_jpeg.c 15+++ b/third_party/libtiff/tif_jpeg.c 16@@ -110,8 +110,16 @@ 17 #define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */ 18 #endif 19 20-#include "jerror.h" 21-#include "jpeglib.h" 22+#if defined(USE_SYSTEM_LIBJPEG) 23+#include <jerror.h> 24+#include <jpeglib.h> 25+#elif defined(USE_LIBJPEG_TURBO) 26+#include "third_party/libjpeg_turbo/jerror.h" 27+#include "third_party/libjpeg_turbo/jpeglib.h" 28+#else 29+#include "third_party/libjpeg/jerror.h" 30+#include "third_party/libjpeg/jpeglib.h" 31+#endif 32 33 /* Do optional compile-time version check */ 34 #if defined(EXPECTED_JPEG_LIB_VERSION) && !defined(LIBJPEG_12_PATH) 35diff a/third_party/libtiff/tiffconf.h b/third_party/libtiff/tiffconf.h 36--- /dev/null 37+++ b/third_party/libtiff/tiffconf.h 38@@ -0,0 +1,244 @@ 39+/* libtiff/tiffconf.h. Generated by configure. */ 40+/* 41+ Configuration defines for installed libtiff. 42+ This file maintained for backward compatibility. Do not use definitions 43+ from this file in your programs. 44+*/ 45+#ifndef _TIFFCONF_ 46+#define _TIFFCONF_ 47+ 48+#include <inttypes.h> 49+#include <stddef.h> 50+#include <stdint.h> 51+ 52+#include "build/build_config.h" 53+ 54+//NOTE: The tiff codec requires an ANSI C compiler environment for building and 55+// presumes an ANSI C environment for use. 56+ 57+# define HAVE_SYS_TYPES_H 1 58+# define HAVE_FCNTL_H 1 59+ 60+/* Compatibility stuff. */ 61+ 62+/* Define to 1 if you have the <assert.h> header file. */ 63+#define HAVE_ASSERT_H 1 64+ 65+/* Define as 0 or 1 according to the floating point format suported by the 66+ machine */ 67+#define HAVE_IEEEFP 1 68+ 69+/* Define to 1 if you have the <string.h> header file. */ 70+#define HAVE_STRING_H 1 71+ 72+/* Define to 1 if you have snprintf(). */ 73+#define HAVE_SNPRINTF 1 74+ 75+/* Define to 1 if you have the <search.h> header file. */ 76+#if BUILDFLAG(IS_WIN) 77+// search.h is always available in VS 2015 and above, and may be 78+// available in earlier versions. 79+#define HAVE_SEARCH_H 1 80+#endif 81+ 82+/* The size of a `int'. */ 83+/* According typedef int int32_t; in the fx_system.h*/ 84+#define SIZEOF_INT 4 85+ 86+#if defined(ARCH_CPU_64_BITS) 87+/* The size of `unsigned long', as computed by sizeof. */ 88+#define SIZEOF_UNSIGNED_LONG 8 89+#else 90+#define SIZEOF_UNSIGNED_LONG 4 91+#endif 92+ 93+/* The size of void*. */ 94+#ifdef __LP64__ 95+#define SIZEOF_VOIDP 8 96+#else 97+#define SIZEOF_VOIDP 4 98+#endif 99+ 100+/* Signed 8-bit type */ 101+#define TIFF_INT8_T signed char 102+ 103+/* Unsigned 8-bit type */ 104+#define TIFF_UINT8_T unsigned char 105+ 106+/* Signed 16-bit type */ 107+#define TIFF_INT16_T signed short 108+ 109+/* Unsigned 16-bit type */ 110+#define TIFF_UINT16_T unsigned short 111+ 112+/* Signed 32-bit type */ 113+#define TIFF_INT32_T signed int 114+ 115+/* Unsigned 32-bit type */ 116+#define TIFF_UINT32_T unsigned int 117+ 118+/* Signed 32-bit type formatter */ 119+#define TIFF_INT32_FORMAT "%d" 120+ 121+/* Unsigned 32-bit type formatter */ 122+#define TIFF_UINT32_FORMAT "%u" 123+ 124+#ifdef _MSC_VER // windows 125+ 126+/* Signed 64-bit type formatter */ 127+#define TIFF_INT64_FORMAT "%I64d" 128+ 129+/* Unsigned 64-bit type formatter */ 130+#define TIFF_UINT64_FORMAT "%I64u" 131+ 132+/* Signed 64-bit type */ 133+#define TIFF_INT64_T signed __int64 134+ 135+/* Unsigned 64-bit type */ 136+#define TIFF_UINT64_T unsigned __int64 137+ 138+#else // linux/unix 139+ 140+#if defined(ARCH_CPU_64_BITS) 141+ 142+/* Signed 64-bit type formatter */ 143+#define TIFF_INT64_FORMAT "%ld" 144+ 145+/* Unsigned 64-bit type formatter */ 146+#define TIFF_UINT64_FORMAT "%lu" 147+ 148+/* Signed 64-bit type */ 149+#define TIFF_INT64_T signed long 150+ 151+/* Unsigned 64-bit type */ 152+#define TIFF_UINT64_T unsigned long 153+ 154+#else // linux/unix 32 155+ 156+/* Signed 64-bit type formatter */ 157+#define TIFF_INT64_FORMAT "%lld" 158+ 159+/* Unsigned 64-bit type formatter */ 160+#define TIFF_UINT64_FORMAT "%llu" 161+ 162+/* Signed 64-bit type */ 163+#define TIFF_INT64_T signed long long 164+ 165+/* Unsigned 64-bit type */ 166+#define TIFF_UINT64_T unsigned long long 167+ 168+#endif // define(ARCH_CPU_64_BITS) 169+ 170+#endif 171+ 172+ 173+/* Signed size type, type formatter, and size of size_t */ 174+#if defined(ARCH_CPU_64_BITS) 175+#define TIFF_SSIZE_T int64_t 176+#define TIFF_SSIZE_FORMAT PRId64 177+#define SIZEOF_SIZE_T 8 178+#else 179+#define TIFF_SSIZE_T int32_t 180+#define TIFF_SSIZE_FORMAT PRId32 181+#define SIZEOF_SIZE_T 4 182+#endif 183+ 184+/* Pointer difference type */ 185+#ifdef _MSC_VER 186+#define TIFF_PTRDIFF_T long 187+#else 188+#define TIFF_PTRDIFF_T ptrdiff_t 189+#endif 190+ 191+/* Signed 64-bit type */ 192+/*#define TIFF_INT64_T signed __int64*/ 193+ 194+/* Unsigned 64-bit type */ 195+/*#define TIFF_UINT64_T unsigned __int64*/ 196+ 197+/* Define to `__inline__' or `__inline' if that's what the C compiler 198+ calls it, or to nothing if 'inline' is not supported under any name. */ 199+#ifndef __cplusplus 200+# ifndef inline 201+# define inline __inline 202+# endif 203+#endif 204+ 205+#define lfind _lfind 206+ 207+#define BSDTYPES 208+ 209+/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */ 210+#define HOST_FILLORDER FILLORDER_LSB2MSB 211+ 212+/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian 213+ (Intel) */ 214+#if _FX_ENDIAN_ == _FX_BIG_ENDIAN_ 215+# define HOST_BIGENDIAN 1 216+#else 217+# define HOST_BIGENDIAN 0 218+#endif 219+ 220+/* Support CCITT Group 3 & 4 algorithms */ 221+#define CCITT_SUPPORT 1 222+ 223+/* Support JPEG compression (requires IJG JPEG library) */ 224+#define JPEG_SUPPORT 1 225+ 226+/* Support LogLuv high dynamic range encoding */ 227+#define LOGLUV_SUPPORT 1 228+ 229+/* Support LZW algorithm */ 230+#define LZW_SUPPORT 1 231+ 232+/* Support NeXT 2-bit RLE algorithm */ 233+#define NEXT_SUPPORT 1 234+ 235+/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation 236+ fails with unpatched IJG JPEG library) */ 237+/* #undef OJPEG_SUPPORT */ 238+ 239+/* Support Macintosh PackBits algorithm */ 240+#define PACKBITS_SUPPORT 1 241+ 242+/* Support Pixar log-format algorithm (requires Zlib) */ 243+#define PIXARLOG_SUPPORT 1 244+ 245+/* Support ThunderScan 4-bit RLE algorithm */ 246+#define THUNDER_SUPPORT 1 247+ 248+/* Support Deflate compression */ 249+/* #undef ZIP_SUPPORT */ 250+ 251+/* Support strip chopping (whether or not to convert single-strip uncompressed 252+ images to mutiple strips of ~8Kb to reduce memory usage) */ 253+#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP 254+ 255+/* Enable SubIFD tag (330) support */ 256+#define SUBIFD_SUPPORT 1 257+ 258+/* Treat extra sample as alpha (default enabled). The RGBA interface will 259+ treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many 260+ packages produce RGBA files but don't mark the alpha properly. */ 261+#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1 262+ 263+/* Pick up YCbCr subsampling info from the JPEG data stream to support files 264+ lacking the tag (default enabled). */ 265+#define CHECK_JPEG_YCBCR_SUBSAMPLING 1 266+ 267+/* Support MS MDI magic number files as TIFF */ 268+#define MDI_SUPPORT 1 269+ 270+/* 271+ * Feature support definitions. 272+ * XXX: These macros are obsoleted. Don't use them in your apps! 273+ * Macros stays here for backward compatibility and should be always defined. 274+ */ 275+#define COLORIMETRY_SUPPORT 276+#define YCBCR_SUPPORT 277+#define CMYK_SUPPORT 278+#define ICC_SUPPORT 279+#define PHOTOSHOP_SUPPORT 280+#define IPTC_SUPPORT 281+ 282+#endif /* _TIFFCONF_ */ 283