summaryrefslogtreecommitdiffstats
path: root/gl/m4/stdint.m4
diff options
context:
space:
mode:
Diffstat (limited to 'gl/m4/stdint.m4')
-rw-r--r--gl/m4/stdint.m472
1 files changed, 70 insertions, 2 deletions
diff --git a/gl/m4/stdint.m4 b/gl/m4/stdint.m4
index b4194c8..a2e8bdd 100644
--- a/gl/m4/stdint.m4
+++ b/gl/m4/stdint.m4
@@ -1,4 +1,4 @@
1# stdint.m4 serial 33 1# stdint.m4 serial 34
2dnl Copyright (C) 2001-2009 Free Software Foundation, Inc. 2dnl Copyright (C) 2001-2009 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation 3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it, 4dnl gives unlimited permission to copy and/or distribute it,
@@ -201,7 +201,75 @@ struct s {
201 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1; 201 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
202}; 202};
203 ]])], 203 ]])],
204 [gl_cv_header_working_stdint_h=yes])]) 204 [dnl Determine whether the various *_MIN, *_MAX macros are usable
205 dnl in preprocessor expression. We could do it by compiling a test
206 dnl program for each of these macros. It is faster to run a program
207 dnl that inspects the macro expansion.
208 dnl This detects a bug on HP-UX 11.23/ia64.
209 AC_RUN_IFELSE([
210 AC_LANG_PROGRAM([[
211#define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */
212#define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */
213#define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
214#include <stdint.h>
215]
216gl_STDINT_INCLUDES
217[
218#include <stdio.h>
219#include <string.h>
220#define MVAL(macro) MVAL1(macro)
221#define MVAL1(expression) #expression
222static const char *macro_values[] =
223 {
224#ifdef INT8_MAX
225 MVAL (INT8_MAX),
226#endif
227#ifdef INT16_MAX
228 MVAL (INT16_MAX),
229#endif
230#ifdef INT32_MAX
231 MVAL (INT32_MAX),
232#endif
233#ifdef INT64_MAX
234 MVAL (INT64_MAX),
235#endif
236#ifdef UINT8_MAX
237 MVAL (UINT8_MAX),
238#endif
239#ifdef UINT16_MAX
240 MVAL (UINT16_MAX),
241#endif
242#ifdef UINT32_MAX
243 MVAL (UINT32_MAX),
244#endif
245#ifdef UINT64_MAX
246 MVAL (UINT64_MAX),
247#endif
248 NULL
249 };
250]], [[
251 const char **mv;
252 for (mv = macro_values; *mv != NULL; mv++)
253 {
254 const char *value = *mv;
255 /* Test whether it looks like a cast expression. */
256 if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
257 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
258 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
259 || strncmp (value, "((int)"/*)*/, 6) == 0
260 || strncmp (value, "((signed short)"/*)*/, 15) == 0
261 || strncmp (value, "((signed char)"/*)*/, 14) == 0)
262 return 1;
263 }
264 return 0;
265]])],
266 [gl_cv_header_working_stdint_h=yes],
267 [],
268 [dnl When cross-compiling, assume it works.
269 gl_cv_header_working_stdint_h=yes
270 ])
271 ])
272 ])
205 fi 273 fi
206 if test "$gl_cv_header_working_stdint_h" = yes; then 274 if test "$gl_cv_header_working_stdint_h" = yes; then
207 STDINT_H= 275 STDINT_H=