Add nmake build support for manually configuring the 'port' files to be

built based on MSVC features.
Include tif_config.h in tools/tiffset.c.
This commit is contained in:
Bob Friesenhahn 2020-01-25 14:11:05 -06:00
parent f5e1d765eb
commit 58b16f47a8
5 changed files with 68 additions and 11 deletions

View File

@ -104,11 +104,22 @@
/* Set the native cpu bit order */
#define HOST_FILLORDER FILLORDER_LSB2MSB
/*
Please see associated settings in "nmake.opt" which configure porting
settings. It should not be necessary to edit the following pre-processor
logic.
*/
#if defined(_MSC_VER)
/* Visual Studio 2015 / VC 14 / MSVC 19.00 finally has snprintf() */
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#else
#define HAVE_SNPRINTF 1
# if _MSC_VER < 1900 /* Visual C++ 2015 */
# define snprintf _snprintf
# else
# define HAVE_SNPRINTF 1
# endif
# if _MSC_VER >= 1920 /* Visual Studio 2019 has strtoll/strtoull */
# define HAVE_STRTOLL 1
# define HAVE_STRTOULL 1
# endif
#endif
/* Define to 1 if your processor stores words with the most significant byte

View File

@ -29,6 +29,7 @@
# Usage examples (see details below):
# nmake -f makefile.vc
# nmake -f makefile.vc DEBUG=1
# nmake -f makefile.vc clean
#
#
###### Edit the following lines to choose a feature set you need. #######
@ -108,6 +109,15 @@ CHECK_JPEG_YCBCR_SUBSAMPLING = 1
####################### Compiler related options. #######################
#
# If your MSVC does not provide strtol() and strtoul(), then these
# should be set to 0.
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
#
# Pick debug or optimized build flags. We default to an optimized build
# with no debugging information.
@ -118,7 +128,7 @@ OPTFLAGS = /MDd /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE
!ELSE
OPTFLAGS = /Ox /MD /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE
!ENDIF
#OPTFLAGS = /Zi
#OPTFLAGS = /Zi
#
# Uncomment following line to enable using Windows Common RunTime Library

View File

@ -23,13 +23,45 @@
# Makefile for MS Visual C and Watcom C compilers.
#
# To build:
# C:\libtiff\port> nmake /f makefile.vc
# C:\libtiff\port> nmake /f makefile.vc
!INCLUDE ..\nmake.opt
!IF $(HAVE_STRTOL)
STRTOL_OBJ =
EXTRAFLAGS = -DHAVE_STRTOL $(EXTRAFLAGS)
!ELSE
STRTOL_OBJ = strtol.obj
!ENDIF
!IF $(HAVE_STRTOUL)
STRTOUL_OBJ =
EXTRAFLAGS = -DHAVE_STRTOUL $(EXTRAFLAGS)
!ELSE
STRTOUL_OBJ = strtoul.obj
!ENDIF
!IF $(HAVE_STRTOLL)
STRTOLL_OBJ =
EXTRAFLAGS = -DHAVE_STRTOLL $(EXTRAFLAGS)
!ELSE
STRTOLL_OBJ = strtoll.obj
!ENDIF
!IF $(HAVE_STRTOULL)
STRTOULL_OBJ =
EXTRAFLAGS = -DHAVE_STRTOULL $(EXTRAFLAGS)
!ELSE
STRTOULL_OBJ = strtoull.obj
!ENDIF
OBJ = \
snprintf.obj \
snprintf.obj \
strcasecmp.obj \
$(STRTOL_OBJ) \
$(STRTOUL_OBJ) \
$(STRTOLL_OBJ) \
$(STRTOULL_OBJ) \
getopt.obj
all: libport.lib

View File

@ -36,16 +36,16 @@ int strcasecmp(const char *s1, const char *s2);
# define HAVE_GETOPT 1
#endif
#if HAVE_STRTOL
#if defined(HAVE_STRTOL)
long strtol(const char *nptr, char **endptr, int base);
#endif
#if HAVE_STRTOLL
#if defined(HAVE_STRTOLL)
long long strtoll(const char *nptr, char **endptr, int base);
#endif
#if HAVE_STRTOUL
#if defined(HAVE_STRTOUL)
unsigned long strtoul(const char *nptr, char **endptr, int base);
#endif
#if HAVE_STRTOULL
#if defined(HAVE_STRTOULL)
unsigned long long strtoull(const char *nptr, char **endptr, int base);
#endif

View File

@ -35,6 +35,10 @@
#include "tiffio.h"
#ifdef NEED_LIBPORT
# include "libport.h"
#endif
static char* usageMsg[] = {
"usage: tiffset [options] filename",
"where options are:",