Fixed bug 1820 - building SDL as a static library with static runtime doesn't compile/link with visual studio
authorSam Lantinga <slouken@libsdl.org>
Sat, 28 Sep 2013 10:30:51 -0700
changeset 77542f67f0616044
parent 7753 e4c38f17bfad
child 7755 f06772125578
Fixed bug 1820 - building SDL as a static library with static runtime doesn't compile/link with visual studio

norfanin

Adds a condition so only the MSVC 2012 compiler defines the macros for the functions of its version.

Attaching a patch that adds a condition so that the HAVE_X supported by MSVC 2012 only get defined with that compiler. MSVC 2008 and 2010 will then build without any modification to the SDL source code.

Also moved HAVE_M_PI to a separate check. The Microsoft headers require _USE_MATH_DEFINES to be defined before they define the constants.
include/SDL_config_windows.h
     1.1 --- a/include/SDL_config_windows.h	Sat Sep 28 13:28:19 2013 -0300
     1.2 +++ b/include/SDL_config_windows.h	Sat Sep 28 10:30:51 2013 -0700
     1.3 @@ -105,12 +105,10 @@
     1.4  #define HAVE_STRCHR 1
     1.5  #define HAVE_STRRCHR 1
     1.6  #define HAVE_STRSTR 1
     1.7 -#define HAVE_ITOA 1
     1.8  #define HAVE__LTOA 1
     1.9  #define HAVE__ULTOA 1
    1.10  #define HAVE_STRTOL 1
    1.11  #define HAVE_STRTOUL 1
    1.12 -#define HAVE_STRTOLL 1
    1.13  #define HAVE_STRTOD 1
    1.14  #define HAVE_ATOI 1
    1.15  #define HAVE_ATOF 1
    1.16 @@ -118,22 +116,28 @@
    1.17  #define HAVE_STRNCMP 1
    1.18  #define HAVE__STRICMP 1
    1.19  #define HAVE__STRNICMP 1
    1.20 -#define HAVE_SSCANF 1
    1.21 -#define HAVE_M_PI 1
    1.22  #define HAVE_ATAN 1
    1.23  #define HAVE_ATAN2 1
    1.24  #define HAVE_CEIL 1
    1.25 -#define HAVE_COPYSIGN 1
    1.26  #define HAVE_COS 1
    1.27  #define HAVE_COSF 1
    1.28  #define HAVE_FABS 1
    1.29  #define HAVE_FLOOR 1
    1.30  #define HAVE_LOG 1
    1.31  #define HAVE_POW 1
    1.32 -#define HAVE_SCALBN 1
    1.33  #define HAVE_SIN 1
    1.34  #define HAVE_SINF 1
    1.35  #define HAVE_SQRT 1
    1.36 +#if _MSC_VER >= 1700
    1.37 +#define HAVE_ITOA 1
    1.38 +#define HAVE_STRTOLL 1
    1.39 +#define HAVE_SSCANF 1
    1.40 +#define HAVE_COPYSIGN 1
    1.41 +#define HAVE_SCALBN 1
    1.42 +#endif
    1.43 +#if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES)
    1.44 +#define HAVE_M_PI 1
    1.45 +#endif
    1.46  #else
    1.47  #define HAVE_STDARG_H   1
    1.48  #define HAVE_STDDEF_H   1