From 39ba1ec447c7fbe24aa048d9cba6c67099c4bfe9 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Fri, 14 Aug 2020 21:08:13 +0200 Subject: [PATCH 1/2] Enable using built-in libtiff on Linux --- libtiff/tif_config.h | 4 ++-- libtiff/tiffconf.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/libtiff/tif_config.h b/libtiff/tif_config.h index f838623d..e0f11c73 100644 --- a/libtiff/tif_config.h +++ b/libtiff/tif_config.h @@ -3,7 +3,7 @@ hardcoded definitions for MSVC, Xcode and MinGW when using makefiles. */ -#ifdef __APPLE__ +#ifndef _WIN32 /* Define to 1 if you have the header file. */ #define HAVE_ASSERT_H 1 @@ -330,7 +330,7 @@ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 -#else /* __APPLE__ */ +#else /* _WIN32 */ /* Define to 1 if you have the header file. */ #define HAVE_ASSERT_H 1 diff --git a/libtiff/tiffconf.h b/libtiff/tiffconf.h index f0dc9bb0..38d8a216 100644 --- a/libtiff/tiffconf.h +++ b/libtiff/tiffconf.h @@ -15,7 +15,7 @@ #ifndef _TIFFCONF_ #define _TIFFCONF_ -#ifdef __APPLE__ +#ifndef _WIN32 #include "tif_config.h" #else From 40e3e51ec6ccdbc079f0c19b07d325239ebe69f1 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Fri, 14 Aug 2020 21:46:10 +0200 Subject: [PATCH 2/2] Swap preprocessor check and use ifdef instead of ifndef --- libtiff/tif_config.h | 208 +++++++++++++++++++++---------------------- 1 file changed, 104 insertions(+), 104 deletions(-) diff --git a/libtiff/tif_config.h b/libtiff/tif_config.h index e0f11c73..924b1865 100644 --- a/libtiff/tif_config.h +++ b/libtiff/tif_config.h @@ -3,7 +3,109 @@ hardcoded definitions for MSVC, Xcode and MinGW when using makefiles. */ -#ifndef _WIN32 +#ifdef _WIN32 + +/* Define to 1 if you have the header file. */ +#define HAVE_ASSERT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define as 0 or 1 according to the floating point format suported by the + machine */ +#define HAVE_IEEEFP 1 + +/* Define to 1 if you have the `jbg_newlen' function. */ +#define HAVE_JBG_NEWLEN 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SEARCH_H 1 + +/* Define to 1 if you have the `setmode' function. */ +#define HAVE_SETMODE 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* The size of a `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of a `long', as computed by sizeof. */ +#define SIZEOF_LONG 4 + +/* Signed 64-bit type formatter */ +#define TIFF_INT64_FORMAT "%I64d" + +/* Signed 64-bit type */ +#define TIFF_INT64_T signed __int64 + +/* Unsigned 64-bit type formatter */ +#define TIFF_UINT64_FORMAT "%I64u" + +/* Unsigned 64-bit type */ +#define TIFF_UINT64_T unsigned __int64 + +/* Set the native cpu bit order */ +#define HOST_FILLORDER FILLORDER_LSB2MSB + +/* + Use _snprintf() with older versions of MSVC and MinGW. + + Note that we can't do this unconditionally as starting from the version + which does have it (MSVS 2015 a.k.a. MSVC 14 a.k.a. _MSC_VER 19.00), it + doesn't allow redefining snprintf any longer. + + Also, MinGW-w32 6.3 uses macro-hackery in its stdio.h which breaks if it is + redefined so, again, only do this for earlier versions. + */ +#if (defined(_MSC_VER) && _MSC_VER < 1900) || \ + (defined(__MINGW32__) && __GNUC__ < 6) +# define snprintf _snprintf +#endif + +/* Define to 1 if your processor stores words with the most significant byte + first (like Motorola and SPARC, unlike Intel and VAX). */ +/* #undef WORDS_BIGENDIAN */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +# ifndef inline +# define inline __inline +# endif +#endif + +#if !defined (__BORLANDC__) && !defined (__WATCOMC__) + #define lfind _lfind +#endif + +#ifdef _WIN32_WCE +# undef HAVE_FCNTL_H +# undef HAVE_SYS_TYPES_H + + /* + CE headers don't define these standard constants (not even underscored + versions), provide our own replacements as they seem to be only used in + libtiff own code anyhow. + */ +# define O_RDONLY 0x0000 +# define O_WRONLY 0x0001 +# define O_RDWR 0x0002 +# define O_CREAT 0x0100 +# define O_TRUNC 0x0200 +# define O_EXCL 0x0400 +#endif /* _WIN32_WCE */ + +#else /* !_WIN32 */ /* Define to 1 if you have the header file. */ #define HAVE_ASSERT_H 1 @@ -330,109 +432,7 @@ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 -#else /* _WIN32 */ - -/* Define to 1 if you have the header file. */ -#define HAVE_ASSERT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define as 0 or 1 according to the floating point format suported by the - machine */ -#define HAVE_IEEEFP 1 - -/* Define to 1 if you have the `jbg_newlen' function. */ -#define HAVE_JBG_NEWLEN 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_IO_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SEARCH_H 1 - -/* Define to 1 if you have the `setmode' function. */ -#define HAVE_SETMODE 1 - -/* Define to 1 if you have the `snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* The size of a `int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of a `long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* Signed 64-bit type formatter */ -#define TIFF_INT64_FORMAT "%I64d" - -/* Signed 64-bit type */ -#define TIFF_INT64_T signed __int64 - -/* Unsigned 64-bit type formatter */ -#define TIFF_UINT64_FORMAT "%I64u" - -/* Unsigned 64-bit type */ -#define TIFF_UINT64_T unsigned __int64 - -/* Set the native cpu bit order */ -#define HOST_FILLORDER FILLORDER_LSB2MSB - -/* - Use _snprintf() with older versions of MSVC and MinGW. - - Note that we can't do this unconditionally as starting from the version - which does have it (MSVS 2015 a.k.a. MSVC 14 a.k.a. _MSC_VER 19.00), it - doesn't allow redefining snprintf any longer. - - Also, MinGW-w32 6.3 uses macro-hackery in its stdio.h which breaks if it is - redefined so, again, only do this for earlier versions. - */ -#if (defined(_MSC_VER) && _MSC_VER < 1900) || \ - (defined(__MINGW32__) && __GNUC__ < 6) -# define snprintf _snprintf -#endif - -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to `__inline__' or `__inline' if that's what the C compiler - calls it, or to nothing if 'inline' is not supported under any name. */ -#ifndef __cplusplus -# ifndef inline -# define inline __inline -# endif -#endif - -#if !defined (__BORLANDC__) && !defined (__WATCOMC__) - #define lfind _lfind -#endif - -#ifdef _WIN32_WCE -# undef HAVE_FCNTL_H -# undef HAVE_SYS_TYPES_H - - /* - CE headers don't define these standard constants (not even underscored - versions), provide our own replacements as they seem to be only used in - libtiff own code anyhow. - */ -# define O_RDONLY 0x0000 -# define O_WRONLY 0x0001 -# define O_RDWR 0x0002 -# define O_CREAT 0x0100 -# define O_TRUNC 0x0200 -# define O_EXCL 0x0400 -#endif /* _WIN32_WCE */ - -#endif /* __APPLE__/!__APPLE__ */ +#endif /* _WIN32/!_WIN32 */ /* * Local Variables: * mode: c