diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-11-17 17:49:20 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-11-17 17:49:20 +0300 |
commit | dc4ef6b517a9c8fad89ae384059b9926f2baa9ea (patch) | |
tree | 7361b66c8daca2f3c225c3fa30edca03e72550f5 | |
parent | c99bb7febbe4ad5f36b1882c94c51e6429a0e7d4 (diff) | |
download | libmicrohttpd-dc4ef6b517a9c8fad89ae384059b9926f2baa9ea.tar.gz libmicrohttpd-dc4ef6b517a9c8fad89ae384059b9926f2baa9ea.zip |
Additional 'bool' configure checks and fixes for old VS compilers
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | w32/common/MHD_config.h | 23 |
2 files changed, 18 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac index a72df1a5..8cdb94b6 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -174,7 +174,9 @@ AC_CACHE_CHECK([[whether "true" and "false" could be used]], [[mhd_cv_macro_true | |||
174 | ]], [[ | 174 | ]], [[ |
175 | int var1[true ? 1 : -1] = { 1 }; | 175 | int var1[true ? 1 : -1] = { 1 }; |
176 | int var2[false ? -1 : 1] = { 2 }; | 176 | int var2[false ? -1 : 1] = { 2 }; |
177 | if (var1[0] == var2[0]) | 177 | int var3[!true ? -1 : 1] = { 3 }; |
178 | int var4[!false ? 1 : -1] = { 4 }; | ||
179 | if (var1[0] == var2[0] || var3[0] == var4[0]) | ||
178 | return 1; | 180 | return 1; |
179 | ]]) | 181 | ]]) |
180 | ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']]) | 182 | ], [[mhd_cv_macro_true_false_valid='yes']], [[mhd_cv_macro_true_false_valid='no']]) |
diff --git a/w32/common/MHD_config.h b/w32/common/MHD_config.h index 793e353c..02d96424 100644 --- a/w32/common/MHD_config.h +++ b/w32/common/MHD_config.h | |||
@@ -9,13 +9,6 @@ | |||
9 | /* Define if MS VC compiler is used */ | 9 | /* Define if MS VC compiler is used */ |
10 | #define MSVC 1 | 10 | #define MSVC 1 |
11 | 11 | ||
12 | /* Define to type which will be used as boolean type. */ | ||
13 | #if _MSC_VER+0 >= 1800 | ||
14 | #define _MHD_bool _Bool | ||
15 | #else /* before VS 2013 */ | ||
16 | #define _MHD_bool int | ||
17 | #endif /* before VS 2013 */ | ||
18 | |||
19 | /* Define to 1 if your C compiler supports inline functions. */ | 12 | /* Define to 1 if your C compiler supports inline functions. */ |
20 | #define INLINE_FUNC 1 | 13 | #define INLINE_FUNC 1 |
21 | 14 | ||
@@ -139,9 +132,23 @@ | |||
139 | /* Define to 1 if you have the <stddef.h> header file. */ | 132 | /* Define to 1 if you have the <stddef.h> header file. */ |
140 | #define HAVE_STDDEF_H 1 | 133 | #define HAVE_STDDEF_H 1 |
141 | 134 | ||
135 | #if _MSC_VER+0 >= 1800 /* VS 2013 and later */ | ||
142 | /* Define to 1 if you have the <stdbool.h> header file and <stdbool.h> defines | 136 | /* Define to 1 if you have the <stdbool.h> header file and <stdbool.h> defines |
143 | 'bool' type. */ | 137 | 'bool' type. */ |
144 | #define HAVE_STDBOOL_H 1 | 138 | #define HAVE_STDBOOL_H 1 |
139 | #else /* before VS 2013 */ | ||
140 | |||
141 | /* Define to type name which will be used as boolean type. */ | ||
142 | #define bool int | ||
143 | |||
144 | /* Define to value interpreted by compiler as boolean "false", if "false" is | ||
145 | not defined by system headers. */ | ||
146 | #define false 0 | ||
147 | |||
148 | /* Define to value interpreted by compiler as boolean "true", if "true" is not | ||
149 | defined by system headers. */ | ||
150 | #define true (!0) | ||
151 | #endif /* before VS 2013 */ | ||
145 | 152 | ||
146 | 153 | ||
147 | /* *** Other useful staff *** */ | 154 | /* *** Other useful staff *** */ |