From: Martin Burnicki Date: Fri, 18 Jan 2013 08:44:02 +0000 (+0100) Subject: Support C99 exact size int types in a way which is compatible with the upcoming X-Git-Tag: NTP_4_2_7P349~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9493934616b6b0812792cfc1c2317c723fce01d6;p=thirdparty%2Fntp.git Support C99 exact size int types in a way which is compatible with the upcoming version of libopts which will not #include unconditionally anymore. Fixes the build errors under Windows reported in [Bug 2321]. bk: 50f90b52F3iREj_iuswnfelrZiu3Eg --- diff --git a/ChangeLog b/ChangeLog index 926bf2b83..4eb3a8f8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 2321] Fixed Windows build, but autogen update still required. (4.2.7p348) 2013/01/17 Released by Harlan Stenn * [Bug 2327] Rename sntp/ag-tpl/:Old to sntp/ag-tpl/Old. * Cleanup to ntpsnmpd-opts.def. diff --git a/ports/winnt/include/config.h b/ports/winnt/include/config.h index 83b36d042..b3390e29f 100644 --- a/ports/winnt/include/config.h +++ b/ports/winnt/include/config.h @@ -10,6 +10,18 @@ #ifndef CONFIG_H #define CONFIG_H +/* + * Known predifined MS compiler version codes: + * 1700: MSVC++ 11.0 (Visual Studio 2012) + * 1600: MSVC++ 10.0 (Visual Studio 2010) + * 1500: MSVC++ 9.0 (Visual Studio 2008) + * 1400: MSVC++ 8.0 (Visual Studio 2005) + * 1310: MSVC++ 7.1 (Visual Studio 2003) + * 1300: MSVC++ 7.0 + * 1200: MSVC++ 6.0 (Visual C++ 6) + * 1100: MSVC++ 5.0 + */ + #if defined(_MSC_VER) && _MSC_VER < 1400 #error Minimum supported Microsoft compiler is Visual C++ 2005. #endif @@ -433,6 +445,40 @@ typedef unsigned long uintptr_t; #define NEED_S_CHAR_TYPEDEF + +/* C99 exact size integer support. */ +#if defined(_MSC_VER) +# define MISSING_INTTYPES_H 1 /* not provided by VS2012 and earlier */ +# define MISSING_STDBOOL_H 1 /* not provided by VS2012 and earlier */ +# if _MSC_VER < 1600 +# define MISSING_STDINT_H 1 /* not provided before VS2010 */ +# endif +#else +/* add defines for non-MS compilers here, if required */ +#endif + +#if !defined(MISSING_INTTYPES_H) +# define HAVE_INTTYPES_H 1 +# include +#elif !defined(MISSING_STDINT_H) +# define HAVE_STDINT_H 1 +# include +#elif !defined(ADDED_EXACT_SIZE_INTEGERS) +# define ADDED_EXACT_SIZE_INTEGERS 1 + typedef __int8 int8_t; + typedef unsigned __int8 uint8_t; + + typedef __int16 int16_t; + typedef unsigned __int16 uint16_t; + + typedef __int32 int32_t; + typedef unsigned __int32 uint32_t; + + typedef __int64 int64_t; + typedef unsigned __int64 uint64_t; +#endif + + /* Directory separator, usually / or \ */ #define DIR_SEP '\\'