From 550f8708d25b913333052cb5c6d3d75f1afdff39 Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Sun, 26 Jan 2020 19:17:23 -0600 Subject: Fix nmake build mistakes in my last commit: tif_config.vc.h: Always define HAVE_STRTOL/HAVE_STRTOUL. Define HAVE_STRTOLL/HAVE_STRTOULL if _MSC_VER >= 1900. nmake.opt: Provide defaults suitable for MSVC prior to 14.0. libport.h: The sense of the pre-processor logic was inverted from what it should be. The intention is to only provide the prototype if the function is missing. --- libtiff/tif_config.vc.h | 4 +++- nmake.opt | 7 +++---- port/libport.h | 8 ++++---- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libtiff/tif_config.vc.h b/libtiff/tif_config.vc.h index 78f3b204..939594f8 100644 --- a/libtiff/tif_config.vc.h +++ b/libtiff/tif_config.vc.h @@ -116,7 +116,9 @@ # else # define HAVE_SNPRINTF 1 # endif -# if _MSC_VER >= 1920 /* Visual Studio 2019 has strtoll/strtoull */ +# define HAVE_STRTOL 1 +# define HAVE_STRTOUL 1 +# if _MSC_VER >= 1900 /* Visual Studio 2015 added strtoll/strtoull */ # define HAVE_STRTOLL 1 # define HAVE_STRTOULL 1 # endif diff --git a/nmake.opt b/nmake.opt index d59be640..79b2fbbb 100644 --- a/nmake.opt +++ b/nmake.opt @@ -109,12 +109,11 @@ CHECK_JPEG_YCBCR_SUBSAMPLING = 1 ####################### Compiler related options. ####################### # -# If your MSVC does not provide strtol() and strtoul(), then these -# should be set to 0. + +# Indicate if the compiler provides strtol/strtoul/strtoll/strtoull. +# Users of MSVC++ 14.0 ("Visual Studio 2015") and later should set all of these to 1 HAVE_STRTOL = 1 HAVE_STRTOUL = 1 - -# Users of MSVC 19.20 ("Visual Studio 2019") and later should set these to 1 HAVE_STRTOLL = 0 HAVE_STRTOULL = 0 diff --git a/port/libport.h b/port/libport.h index 24e559b6..cb302ef4 100644 --- a/port/libport.h +++ b/port/libport.h @@ -36,16 +36,16 @@ int strcasecmp(const char *s1, const char *s2); # define HAVE_GETOPT 1 #endif -#if defined(HAVE_STRTOL) +#if !defined(HAVE_STRTOL) long strtol(const char *nptr, char **endptr, int base); #endif -#if defined(HAVE_STRTOLL) +#if !defined(HAVE_STRTOLL) long long strtoll(const char *nptr, char **endptr, int base); #endif -#if defined(HAVE_STRTOUL) +#if !defined(HAVE_STRTOUL) unsigned long strtoul(const char *nptr, char **endptr, int base); #endif -#if defined(HAVE_STRTOULL) +#if !defined(HAVE_STRTOULL) unsigned long long strtoull(const char *nptr, char **endptr, int base); #endif -- cgit v1.2.1