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;