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