From 7a335a32ebbce103d429c82a8d60d25ead1ccf0e Mon Sep 17 00:00:00 2001 From: Bob Friesenhahn Date: Wed, 29 Jan 2020 08:03:39 -0600 Subject: Simplify nmake configuration for building port directory. Now there is only one boolean setting to enable building strtoll() and strtoull() port functions. The boolean setting enables the necessary port files to be built, but the remainder of the logic is via pre-processor code in the common tif_config.h, which was prepared before entering the port directory to do a build. --- nmake.opt | 11 ++++------- port/Makefile.vc | 14 ++++++++++---- port/libport.h | 4 ++++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/nmake.opt b/nmake.opt index 79b2fbbb..d9bf15f1 100644 --- a/nmake.opt +++ b/nmake.opt @@ -110,12 +110,9 @@ CHECK_JPEG_YCBCR_SUBSAMPLING = 1 # -# 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 -HAVE_STRTOLL = 0 -HAVE_STRTOULL = 0 +# Indicate if the compiler provides strtoll/strtoull (default 1) +# Users of MSVC++ 14.0 ("Visual Studio 2015") and later should set this to 1 +HAVE_STRTOLL = 1 # # Pick debug or optimized build flags. We default to an optimized build @@ -148,7 +145,7 @@ LD = link /nologo CFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) CXXFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) -EXTRAFLAGS = +EXTRAFLAGS = -DHAVE_CONFIG_H LIBS = # Name of the output shared library diff --git a/port/Makefile.vc b/port/Makefile.vc index 6122b192..e4471af5 100644 --- a/port/Makefile.vc +++ b/port/Makefile.vc @@ -27,30 +27,36 @@ !INCLUDE ..\nmake.opt +HAVE_STRTOL = 1 +HAVE_STRTOUL = 1 + +# strtoul()/strtoull() are provided together +!IF $(HAVE_STRTOLL) +HAVE_STRTOULL = 1 +!ELSE +HAVE_STRTOULL = 0 +!endif + !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 diff --git a/port/libport.h b/port/libport.h index cb302ef4..9f2dace1 100644 --- a/port/libport.h +++ b/port/libport.h @@ -24,6 +24,10 @@ #ifndef _LIBPORT_ #define _LIBPORT_ +#if defined(HAVE_CONFIG_H) +# include +#endif + int getopt(int argc, char * const argv[], const char *optstring); extern char *optarg; extern int opterr; -- cgit v1.2.1