annotate m4/stdint.m4 @ 40057:b06060465f09

maint: Run 'make update-copyright'
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 01 Jan 2019 00:25:11 +0100
parents eb64273b66c2
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39944
eb64273b66c2 Assume Autoconf >= 2.63.
Bruno Haible <bruno@clisp.org>
parents: 39800
diff changeset
1 # stdint.m4 serial 53
40057
b06060465f09 maint: Run 'make update-copyright'
Paul Eggert <eggert@cs.ucla.edu>
parents: 39944
diff changeset
2 dnl Copyright (C) 2001-2019 Free Software Foundation, Inc.
5611
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5219
diff changeset
3 dnl This file is free software; the Free Software Foundation
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5219
diff changeset
4 dnl gives unlimited permission to copy and/or distribute it,
87c42e194f4a Use an all-permissive copyright notice, recommended by RMS.
Paul Eggert <eggert@cs.ucla.edu>
parents: 5219
diff changeset
5 dnl with or without modifications, as long as this notice is preserved.
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
6
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
7 dnl From Paul Eggert and Bruno Haible.
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
8 dnl Test whether <stdint.h> is supported or must be substituted.
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
9
39944
eb64273b66c2 Assume Autoconf >= 2.63.
Bruno Haible <bruno@clisp.org>
parents: 39800
diff changeset
10 AC_PREREQ([2.61])
eb64273b66c2 Assume Autoconf >= 2.63.
Bruno Haible <bruno@clisp.org>
parents: 39800
diff changeset
11
14747
1ed391f686fa inttypes: avoid autoconf warning
Eric Blake <eblake@redhat.com>
parents: 14528
diff changeset
12 AC_DEFUN_ONCE([gl_STDINT_H],
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
13 [
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10971
diff changeset
14 AC_PREREQ([2.59])dnl
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
15 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
16
18423
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
17 AC_REQUIRE([gl_LIMITS_H])
18610
4e0829b9b9bb stdint: Fix WINT_MAX to match the gnulib provided wint_t on minw.
Bruno Haible <bruno@clisp.org>
parents: 18577
diff changeset
18 AC_REQUIRE([gt_TYPE_WINT_T])
18423
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
19
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
20 dnl Check for long long int and unsigned long long int.
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
21 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
22 if test $ac_cv_type_long_long_int = yes; then
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
23 HAVE_LONG_LONG_INT=1
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
24 else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
25 HAVE_LONG_LONG_INT=0
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
26 fi
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
27 AC_SUBST([HAVE_LONG_LONG_INT])
7468
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
28 AC_REQUIRE([AC_TYPE_UNSIGNED_LONG_LONG_INT])
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
29 if test $ac_cv_type_unsigned_long_long_int = yes; then
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
30 HAVE_UNSIGNED_LONG_LONG_INT=1
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
31 else
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
32 HAVE_UNSIGNED_LONG_LONG_INT=0
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
33 fi
75d103bb0830 Port to Tandem NSK OSS, which has 64-bit signed int but at most
Paul Eggert <eggert@cs.ucla.edu>
parents: 7223
diff changeset
34 AC_SUBST([HAVE_UNSIGNED_LONG_LONG_INT])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
35
14367
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
36 dnl Check for <wchar.h>, in the same way as gl_WCHAR_H does.
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
37 AC_CHECK_HEADERS_ONCE([wchar.h])
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
38 if test $ac_cv_header_wchar_h = yes; then
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
39 HAVE_WCHAR_H=1
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
40 else
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
41 HAVE_WCHAR_H=0
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
42 fi
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
43 AC_SUBST([HAVE_WCHAR_H])
8c612d3fafe7 stdint: Cut dependency to module 'wchar'.
Bruno Haible <bruno@clisp.org>
parents: 14249
diff changeset
44
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
45 dnl Check for <inttypes.h>.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
46 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_inttypes_h.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
47 if test $ac_cv_header_inttypes_h = yes; then
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
48 HAVE_INTTYPES_H=1
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
49 else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
50 HAVE_INTTYPES_H=0
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
51 fi
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
52 AC_SUBST([HAVE_INTTYPES_H])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
53
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
54 dnl Check for <sys/types.h>.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
55 dnl AC_INCLUDES_DEFAULT defines $ac_cv_header_sys_types_h.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
56 if test $ac_cv_header_sys_types_h = yes; then
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
57 HAVE_SYS_TYPES_H=1
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
58 else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
59 HAVE_SYS_TYPES_H=0
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
60 fi
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
61 AC_SUBST([HAVE_SYS_TYPES_H])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
62
8995
1025663f7658 * m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents: 8922
diff changeset
63 gl_CHECK_NEXT_HEADERS([stdint.h])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
64 if test $ac_cv_header_stdint_h = yes; then
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
65 HAVE_STDINT_H=1
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
66 else
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
67 HAVE_STDINT_H=0
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
68 fi
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
69 AC_SUBST([HAVE_STDINT_H])
5219
fcff9e1a6e22 New module 'stdint'.
Bruno Haible <bruno@clisp.org>
parents:
diff changeset
70
8995
1025663f7658 * m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents: 8922
diff changeset
71 dnl Now see whether we need a substitute <stdint.h>.
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
72 if test $ac_cv_header_stdint_h = yes; then
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
73 AC_CACHE_CHECK([whether stdint.h conforms to C99],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
74 [gl_cv_header_working_stdint_h],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
75 [gl_cv_header_working_stdint_h=no
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
76 AC_COMPILE_IFELSE([
9135
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
77 AC_LANG_PROGRAM([[
8995
1025663f7658 * m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents: 8922
diff changeset
78 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
18289
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
79 #define __STDC_CONSTANT_MACROS 1
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
80 #define __STDC_LIMIT_MACROS 1
8995
1025663f7658 * m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents: 8922
diff changeset
81 #include <stdint.h>
9135
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
82 /* Dragonfly defines WCHAR_MIN, WCHAR_MAX only in <wchar.h>. */
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
83 #if !(defined WCHAR_MIN && defined WCHAR_MAX)
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
84 #error "WCHAR_MIN, WCHAR_MAX not defined in <stdint.h>"
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
85 #endif
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
86 ]
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
87 gl_STDINT_INCLUDES
5a648774d6a3 Don't pretend that stdint.h conforms to C99 if it doesn't define WCHAR_MIN
Bruno Haible <bruno@clisp.org>
parents: 8995
diff changeset
88 [
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
89 #ifdef INT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
90 int8_t a1 = INT8_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
91 int8_t a1min = INT8_MIN;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
92 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
93 #ifdef INT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
94 int16_t a2 = INT16_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
95 int16_t a2min = INT16_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
96 #endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
97 #ifdef INT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
98 int32_t a3 = INT32_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
99 int32_t a3min = INT32_MIN;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
100 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
101 #ifdef INT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
102 int64_t a4 = INT64_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
103 int64_t a4min = INT64_MIN;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
104 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
105 #ifdef UINT8_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
106 uint8_t b1 = UINT8_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
107 #else
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
108 typedef int b1[(unsigned char) -1 != 255 ? 1 : -1];
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
109 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
110 #ifdef UINT16_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
111 uint16_t b2 = UINT16_MAX;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
112 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
113 #ifdef UINT32_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
114 uint32_t b3 = UINT32_MAX;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
115 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
116 #ifdef UINT64_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
117 uint64_t b4 = UINT64_MAX;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
118 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
119 int_least8_t c1 = INT8_C (0x7f);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
120 int_least8_t c1max = INT_LEAST8_MAX;
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
121 int_least8_t c1min = INT_LEAST8_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
122 int_least16_t c2 = INT16_C (0x7fff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
123 int_least16_t c2max = INT_LEAST16_MAX;
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
124 int_least16_t c2min = INT_LEAST16_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
125 int_least32_t c3 = INT32_C (0x7fffffff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
126 int_least32_t c3max = INT_LEAST32_MAX;
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
127 int_least32_t c3min = INT_LEAST32_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
128 int_least64_t c4 = INT64_C (0x7fffffffffffffff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
129 int_least64_t c4max = INT_LEAST64_MAX;
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
130 int_least64_t c4min = INT_LEAST64_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
131 uint_least8_t d1 = UINT8_C (0xff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
132 uint_least8_t d1max = UINT_LEAST8_MAX;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
133 uint_least16_t d2 = UINT16_C (0xffff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
134 uint_least16_t d2max = UINT_LEAST16_MAX;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
135 uint_least32_t d3 = UINT32_C (0xffffffff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
136 uint_least32_t d3max = UINT_LEAST32_MAX;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
137 uint_least64_t d4 = UINT64_C (0xffffffffffffffff);
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
138 uint_least64_t d4max = UINT_LEAST64_MAX;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
139 int_fast8_t e1 = INT_FAST8_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
140 int_fast8_t e1min = INT_FAST8_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
141 int_fast16_t e2 = INT_FAST16_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
142 int_fast16_t e2min = INT_FAST16_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
143 int_fast32_t e3 = INT_FAST32_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
144 int_fast32_t e3min = INT_FAST32_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
145 int_fast64_t e4 = INT_FAST64_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
146 int_fast64_t e4min = INT_FAST64_MIN;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
147 uint_fast8_t f1 = UINT_FAST8_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
148 uint_fast16_t f2 = UINT_FAST16_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
149 uint_fast32_t f3 = UINT_FAST32_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
150 uint_fast64_t f4 = UINT_FAST64_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
151 #ifdef INTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
152 intptr_t g = INTPTR_MAX;
7051
9f1099d5f664 Verify the existence of some more macros.
Bruno Haible <bruno@clisp.org>
parents: 7049
diff changeset
153 intptr_t gmin = INTPTR_MIN;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
154 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
155 #ifdef UINTPTR_MAX
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
156 uintptr_t h = UINTPTR_MAX;
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
157 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
158 intmax_t i = INTMAX_MAX;
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
159 uintmax_t j = UINTMAX_MAX;
8911
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
160
18449
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
161 /* Check that SIZE_MAX has the correct type, if possible. */
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
162 #if 201112 <= __STDC_VERSION__
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
163 int k = _Generic (SIZE_MAX, size_t: 0);
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
164 #elif (2 <= __GNUC__ || defined __IBM__TYPEOF__ \
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
165 || (0x5110 <= __SUNPRO_C && !__STDC__))
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
166 extern size_t k;
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
167 extern __typeof__ (SIZE_MAX) k;
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
168 #endif
9d034f84125b stdint: port SIZE_MAX to glibc s390
Paul Eggert <eggert@cs.ucla.edu>
parents: 18429
diff changeset
169
8911
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
170 #include <limits.h> /* for CHAR_BIT */
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
171 #define TYPE_MINIMUM(t) \
14249
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
172 ((t) ((t) 0 < (t) -1 ? (t) 0 : ~ TYPE_MAXIMUM (t)))
8911
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
173 #define TYPE_MAXIMUM(t) \
14249
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
174 ((t) ((t) 0 < (t) -1 \
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
175 ? (t) -1 \
52b55b447c02 TYPE_MAXIMUM: avoid theoretically undefined behavior
Paul Eggert <eggert@cs.ucla.edu>
parents: 14079
diff changeset
176 : ((((t) 1 << (sizeof (t) * CHAR_BIT - 2)) - 1) * 2 + 1)))
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
177 struct s {
8911
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
178 int check_PTRDIFF:
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
179 PTRDIFF_MIN == TYPE_MINIMUM (ptrdiff_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
180 && PTRDIFF_MAX == TYPE_MAXIMUM (ptrdiff_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
181 ? 1 : -1;
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
182 /* Detect bug in FreeBSD 6.0 / ia64. */
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
183 int check_SIG_ATOMIC:
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
184 SIG_ATOMIC_MIN == TYPE_MINIMUM (sig_atomic_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
185 && SIG_ATOMIC_MAX == TYPE_MAXIMUM (sig_atomic_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
186 ? 1 : -1;
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
187 int check_SIZE: SIZE_MAX == TYPE_MAXIMUM (size_t) ? 1 : -1;
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
188 int check_WCHAR:
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
189 WCHAR_MIN == TYPE_MINIMUM (wchar_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
190 && WCHAR_MAX == TYPE_MAXIMUM (wchar_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
191 ? 1 : -1;
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
192 /* Detect bug in mingw. */
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
193 int check_WINT:
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
194 WINT_MIN == TYPE_MINIMUM (wint_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
195 && WINT_MAX == TYPE_MAXIMUM (wint_t)
c7bb3a4ffc9b Fix incorrect values of SIG_ATOMIC_MIN, SIG_ATOMIC_MAX on FreeBSD/ia64.
Bruno Haible <bruno@clisp.org>
parents: 8904
diff changeset
196 ? 1 : -1;
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
197
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
198 /* Detect bugs in glibc 2.4 and Solaris 10 stdint.h, among others. */
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
199 int check_UINT8_C:
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
200 (-1 < UINT8_C (0)) == (-1 < (uint_least8_t) 0) ? 1 : -1;
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
201 int check_UINT16_C:
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
202 (-1 < UINT16_C (0)) == (-1 < (uint_least16_t) 0) ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
203
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
204 /* Detect bugs in OpenBSD 3.9 stdint.h. */
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
205 #ifdef UINT8_MAX
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
206 int check_uint8: (uint8_t) -1 == UINT8_MAX ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
207 #endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
208 #ifdef UINT16_MAX
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
209 int check_uint16: (uint16_t) -1 == UINT16_MAX ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
210 #endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
211 #ifdef UINT32_MAX
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
212 int check_uint32: (uint32_t) -1 == UINT32_MAX ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
213 #endif
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
214 #ifdef UINT64_MAX
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
215 int check_uint64: (uint64_t) -1 == UINT64_MAX ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
216 #endif
6909
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
217 int check_uint_least8: (uint_least8_t) -1 == UINT_LEAST8_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
218 int check_uint_least16: (uint_least16_t) -1 == UINT_LEAST16_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
219 int check_uint_least32: (uint_least32_t) -1 == UINT_LEAST32_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
220 int check_uint_least64: (uint_least64_t) -1 == UINT_LEAST64_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
221 int check_uint_fast8: (uint_fast8_t) -1 == UINT_FAST8_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
222 int check_uint_fast16: (uint_fast16_t) -1 == UINT_FAST16_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
223 int check_uint_fast32: (uint_fast32_t) -1 == UINT_FAST32_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
224 int check_uint_fast64: (uint_fast64_t) -1 == UINT_FAST64_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
225 int check_uintptr: (uintptr_t) -1 == UINTPTR_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
226 int check_uintmax: (uintmax_t) -1 == UINTMAX_MAX ? 1 : -1;
731ed1859b96 * stdint.m4 (gl_STDINT_H): Use more-mnemonic identifiers for
Paul Eggert <eggert@cs.ucla.edu>
parents: 6906
diff changeset
227 int check_size: (size_t) -1 == SIZE_MAX ? 1 : -1;
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
228 };
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
229 ]])],
11216
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
230 [dnl Determine whether the various *_MIN, *_MAX macros are usable
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
231 dnl in preprocessor expression. We could do it by compiling a test
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
232 dnl program for each of these macros. It is faster to run a program
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
233 dnl that inspects the macro expansion.
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
234 dnl This detects a bug on HP-UX 11.23/ia64.
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
235 AC_RUN_IFELSE([
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
236 AC_LANG_PROGRAM([[
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
237 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
18289
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
238 #define __STDC_CONSTANT_MACROS 1
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
239 #define __STDC_LIMIT_MACROS 1
11216
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
240 #include <stdint.h>
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
241 ]
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
242 gl_STDINT_INCLUDES
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
243 [
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
244 #include <stdio.h>
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
245 #include <string.h>
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
246 #define MVAL(macro) MVAL1(macro)
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
247 #define MVAL1(expression) #expression
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
248 static const char *macro_values[] =
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
249 {
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
250 #ifdef INT8_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
251 MVAL (INT8_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
252 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
253 #ifdef INT16_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
254 MVAL (INT16_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
255 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
256 #ifdef INT32_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
257 MVAL (INT32_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
258 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
259 #ifdef INT64_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
260 MVAL (INT64_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
261 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
262 #ifdef UINT8_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
263 MVAL (UINT8_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
264 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
265 #ifdef UINT16_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
266 MVAL (UINT16_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
267 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
268 #ifdef UINT32_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
269 MVAL (UINT32_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
270 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
271 #ifdef UINT64_MAX
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
272 MVAL (UINT64_MAX),
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
273 #endif
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
274 NULL
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
275 };
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
276 ]], [[
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
277 const char **mv;
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
278 for (mv = macro_values; *mv != NULL; mv++)
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
279 {
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
280 const char *value = *mv;
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
281 /* Test whether it looks like a cast expression. */
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
282 if (strncmp (value, "((unsigned int)"/*)*/, 15) == 0
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
283 || strncmp (value, "((unsigned short)"/*)*/, 17) == 0
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
284 || strncmp (value, "((unsigned char)"/*)*/, 16) == 0
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
285 || strncmp (value, "((int)"/*)*/, 6) == 0
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
286 || strncmp (value, "((signed short)"/*)*/, 15) == 0
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
287 || strncmp (value, "((signed char)"/*)*/, 14) == 0)
13918
d5a74c6ec06b Put more information about failed tests into the test return codes.
Bruno Haible <bruno@clisp.org>
parents: 13396
diff changeset
288 return mv - macro_values + 1;
11216
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
289 }
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
290 return 0;
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
291 ]])],
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
292 [gl_cv_header_working_stdint_h=yes],
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
293 [],
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
294 [case "$host_os" in
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
295 # Guess yes on native Windows.
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
296 mingw*) gl_cv_header_working_stdint_h="guessing yes" ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
297 # In general, assume it works.
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
298 *) gl_cv_header_working_stdint_h="guessing yes" ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
299 esac
11216
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
300 ])
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
301 ])
990c0f0a5097 Work around broken INT8_MAX, UINT8_MAX etc. values on HP-UX 11.23.
Bruno Haible <bruno@clisp.org>
parents: 11007
diff changeset
302 ])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
303 fi
18423
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
304
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
305 HAVE_C99_STDINT_H=0
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
306 HAVE_SYS_BITYPES_H=0
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
307 HAVE_SYS_INTTYPES_H=0
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
308 STDINT_H=stdint.h
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
309 case "$gl_cv_header_working_stdint_h" in
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
310 *yes)
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
311 HAVE_C99_STDINT_H=1
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
312 dnl Now see whether the system <stdint.h> works without
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
313 dnl __STDC_CONSTANT_MACROS/__STDC_LIMIT_MACROS defined.
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
314 AC_CACHE_CHECK([whether stdint.h predates C++11],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
315 [gl_cv_header_stdint_predates_cxx11_h],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
316 [gl_cv_header_stdint_predates_cxx11_h=yes
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
317 AC_COMPILE_IFELSE([
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
318 AC_LANG_PROGRAM([[
18289
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
319 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1 /* work if build isn't clean */
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
320 #include <stdint.h>
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
321 ]
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
322 gl_STDINT_INCLUDES
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
323 [
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
324 intmax_t im = INTMAX_MAX;
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
325 int32_t i32 = INT32_C (0x7fffffff);
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
326 ]])],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
327 [gl_cv_header_stdint_predates_cxx11_h=no])])
18289
9947a0359c68 stdint: detect good enough pre-C++11 stdint.h in C++ mode
Pedro Alves <palves@redhat.com>
parents: 18189
diff changeset
328
18993
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
329 if test "$gl_cv_header_stdint_predates_cxx11_h" = yes; then
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
330 AC_DEFINE([__STDC_CONSTANT_MACROS], [1],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
331 [Define to 1 if the system <stdint.h> predates C++11.])
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
332 AC_DEFINE([__STDC_LIMIT_MACROS], [1],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
333 [Define to 1 if the system <stdint.h> predates C++11.])
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
334 fi
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
335 AC_CACHE_CHECK([whether stdint.h has UINTMAX_WIDTH etc.],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
336 [gl_cv_header_stdint_width],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
337 [gl_cv_header_stdint_width=no
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
338 AC_COMPILE_IFELSE(
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
339 [AC_LANG_PROGRAM([[
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
340 /* Work if build is not clean. */
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
341 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H 1
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
342 #ifndef __STDC_WANT_IEC_60559_BFP_EXT__
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
343 #define __STDC_WANT_IEC_60559_BFP_EXT__ 1
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
344 #endif
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
345 #include <stdint.h>
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
346 ]gl_STDINT_INCLUDES[
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
347 int iw = UINTMAX_WIDTH;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
348 ]])],
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
349 [gl_cv_header_stdint_width=yes])])
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
350 if test "$gl_cv_header_stdint_width" = yes; then
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
351 STDINT_H=
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
352 fi
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
353 ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
354 *)
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
355 dnl Check for <sys/inttypes.h>, and for
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
356 dnl <sys/bitypes.h> (used in Linux libc4 >= 4.6.7 and libc5).
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
357 AC_CHECK_HEADERS([sys/inttypes.h sys/bitypes.h])
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
358 if test $ac_cv_header_sys_inttypes_h = yes; then
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
359 HAVE_SYS_INTTYPES_H=1
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
360 fi
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
361 if test $ac_cv_header_sys_bitypes_h = yes; then
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
362 HAVE_SYS_BITYPES_H=1
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
363 fi
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
364 gl_STDINT_TYPE_PROPERTIES
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
365 ;;
a75cfc731331 Improve cross-compilation guesses for native Windows.
Bruno Haible <bruno@clisp.org>
parents: 18626
diff changeset
366 esac
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
367
18577
9dc5ca6c3a57 stdint: Fix WINT_MAX to match the gnulib provided wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 18449
diff changeset
368 dnl The substitute stdint.h needs the substitute limit.h's _GL_INTEGER_WIDTH.
39800
516c78d5715b limits-h: Formalize side effects from other modules.
Bruno Haible <bruno@clisp.org>
parents: 19484
diff changeset
369 gl_REPLACE_LIMITS_H
18423
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
370
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
371 AC_SUBST([HAVE_C99_STDINT_H])
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
372 AC_SUBST([HAVE_SYS_BITYPES_H])
670fe923ee56 stdint: support new _WIDTH macros
Paul Eggert <eggert@cs.ucla.edu>
parents: 18289
diff changeset
373 AC_SUBST([HAVE_SYS_INTTYPES_H])
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10971
diff changeset
374 AC_SUBST([STDINT_H])
14528
662ae53d8d37 Remove leftover generated .h files after config.status changed.
Bruno Haible <bruno@clisp.org>
parents: 14368
diff changeset
375 AM_CONDITIONAL([GL_GENERATE_STDINT_H], [test -n "$STDINT_H"])
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
376 ])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
377
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
378 dnl gl_STDINT_BITSIZEOF(TYPES, INCLUDES)
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
379 dnl Determine the size of each of the given types in bits.
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
380 AC_DEFUN([gl_STDINT_BITSIZEOF],
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
381 [
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
382 dnl Use a shell loop, to avoid bloating configure, and
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
383 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
384 dnl config.h.in,
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
385 dnl - extra AC_SUBST calls, so that the right substitutions are made.
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
386 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
387 [AH_TEMPLATE([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
388 [Define to the number of bits in type ']gltype['.])])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
389 for gltype in $1 ; do
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
390 AC_CACHE_CHECK([for bit size of $gltype], [gl_cv_bitsizeof_${gltype}],
7693
52002c9e5fd9 * m4/stdint.m4 (gl_STDINT_BITSIZEOF): Use AC_COMPUTE_INT instead of
Paul Eggert <eggert@cs.ucla.edu>
parents: 7468
diff changeset
391 [AC_COMPUTE_INT([result], [sizeof ($gltype) * CHAR_BIT],
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
392 [$2
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
393 #include <limits.h>], [result=unknown])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
394 eval gl_cv_bitsizeof_${gltype}=\$result
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
395 ])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
396 eval result=\$gl_cv_bitsizeof_${gltype}
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
397 if test $result = unknown; then
6873
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
398 dnl Use a nonempty default, because some compilers, such as IRIX 5 cc,
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
399 dnl do a syntax check even on unused #if conditions and give an error
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
400 dnl on valid C code like this:
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
401 dnl #if 0
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
402 dnl # if > 32
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
403 dnl # endif
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
404 dnl #endif
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
405 result=0
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
406 fi
6873
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
407 GLTYPE=`echo "$gltype" | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
408 AC_DEFINE_UNQUOTED([BITSIZEOF_${GLTYPE}], [$result])
19d1a55a5de8 Avoid generating C code that some compilers don't accept.
Bruno Haible <bruno@clisp.org>
parents: 6868
diff changeset
409 eval BITSIZEOF_${GLTYPE}=\$result
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
410 done
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
411 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
412 [AC_SUBST([BITSIZEOF_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
413 ])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
414
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
415 dnl gl_CHECK_TYPES_SIGNED(TYPES, INCLUDES)
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
416 dnl Determine the signedness of each of the given types.
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
417 dnl Define HAVE_SIGNED_TYPE if type is signed.
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
418 AC_DEFUN([gl_CHECK_TYPES_SIGNED],
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
419 [
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
420 dnl Use a shell loop, to avoid bloating configure, and
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
421 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
422 dnl config.h.in,
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
423 dnl - extra AC_SUBST calls, so that the right substitutions are made.
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
424 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
425 [AH_TEMPLATE([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]),
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
426 [Define to 1 if ']gltype[' is a signed integer type.])])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
427 for gltype in $1 ; do
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
428 AC_CACHE_CHECK([whether $gltype is signed], [gl_cv_type_${gltype}_signed],
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
429 [AC_COMPILE_IFELSE(
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
430 [AC_LANG_PROGRAM([$2[
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
431 int verify[2 * (($gltype) -1 < ($gltype) 0) - 1];]])],
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
432 result=yes, result=no)
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
433 eval gl_cv_type_${gltype}_signed=\$result
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
434 ])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
435 eval result=\$gl_cv_type_${gltype}_signed
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
436 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
437 if test "$result" = yes; then
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10971
diff changeset
438 AC_DEFINE_UNQUOTED([HAVE_SIGNED_${GLTYPE}], [1])
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
439 eval HAVE_SIGNED_${GLTYPE}=1
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
440 else
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
441 eval HAVE_SIGNED_${GLTYPE}=0
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
442 fi
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
443 done
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
444 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
445 [AC_SUBST([HAVE_SIGNED_]m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_]))])
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
446 ])
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
447
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
448 dnl gl_INTEGER_TYPE_SUFFIX(TYPES, INCLUDES)
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
449 dnl Determine the suffix to use for integer constants of the given types.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
450 dnl Define t_SUFFIX for each such type.
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
451 AC_DEFUN([gl_INTEGER_TYPE_SUFFIX],
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
452 [
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
453 dnl Use a shell loop, to avoid bloating configure, and
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
454 dnl - extra AH_TEMPLATE calls, so that autoheader knows what to put into
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
455 dnl config.h.in,
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
456 dnl - extra AC_SUBST calls, so that the right substitutions are made.
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
457 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
458 [AH_TEMPLATE(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX],
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
459 [Define to l, ll, u, ul, ull, etc., as suitable for
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
460 constants of type ']gltype['.])])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
461 for gltype in $1 ; do
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
462 AC_CACHE_CHECK([for $gltype integer literal suffix],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
463 [gl_cv_type_${gltype}_suffix],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
464 [eval gl_cv_type_${gltype}_suffix=no
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
465 eval result=\$gl_cv_type_${gltype}_signed
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
466 if test "$result" = yes; then
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
467 glsufu=
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
468 else
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
469 glsufu=u
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
470 fi
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
471 for glsuf in "$glsufu" ${glsufu}l ${glsufu}ll ${glsufu}i64; do
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
472 case $glsuf in
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
473 '') gltype1='int';;
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
474 l) gltype1='long int';;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
475 ll) gltype1='long long int';;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
476 i64) gltype1='__int64';;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
477 u) gltype1='unsigned int';;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
478 ul) gltype1='unsigned long int';;
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 11216
diff changeset
479 ull) gltype1='unsigned long long int';;
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
480 ui64)gltype1='unsigned __int64';;
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
481 esac
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
482 AC_COMPILE_IFELSE(
9921
01cfd65cc7e0 Fix underquoting of AC_LANG_PROGRAM arguments.
Bruno Haible <bruno@clisp.org>
parents: 9879
diff changeset
483 [AC_LANG_PROGRAM([$2[
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
484 extern $gltype foo;
9921
01cfd65cc7e0 Fix underquoting of AC_LANG_PROGRAM arguments.
Bruno Haible <bruno@clisp.org>
parents: 9879
diff changeset
485 extern $gltype1 foo;]])],
7889
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
486 [eval gl_cv_type_${gltype}_suffix=\$glsuf])
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
487 eval result=\$gl_cv_type_${gltype}_suffix
5c31327eb3ea Untabify.
Bruno Haible <bruno@clisp.org>
parents: 7888
diff changeset
488 test "$result" != no && break
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
489 done])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
490 GLTYPE=`echo $gltype | tr 'abcdefghijklmnopqrstuvwxyz ' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
491 eval result=\$gl_cv_type_${gltype}_suffix
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
492 test "$result" = no && result=
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
493 eval ${GLTYPE}_SUFFIX=\$result
11007
f6cba5a556ce many *.m4 files: improve m4 quoting
Jim Meyering <meyering@redhat.com>
parents: 10971
diff changeset
494 AC_DEFINE_UNQUOTED([${GLTYPE}_SUFFIX], [$result])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
495 done
9879
e0ce0891df69 Avoid some more autoconf warnings.
Eric Blake <ebb9@byu.net>
parents: 9261
diff changeset
496 m4_foreach_w([gltype], [$1],
13396
a6b472aaadaf Prefer documented low-level autoconf macro names.
Bruno Haible <bruno@clisp.org>
parents: 12559
diff changeset
497 [AC_SUBST(m4_translit(gltype,[abcdefghijklmnopqrstuvwxyz ],[ABCDEFGHIJKLMNOPQRSTUVWXYZ_])[_SUFFIX])])
6826
e896d59bd228 Rewrite module 'stdint' to be fully autoconfiguring.
Bruno Haible <bruno@clisp.org>
parents: 6510
diff changeset
498 ])
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
499
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
500 dnl gl_STDINT_INCLUDES
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
501 AC_DEFUN([gl_STDINT_INCLUDES],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
502 [[
7888
b6376840b47b * modules/fnmatch (Depends-on): Depend on wchar.
Eric Blake <ebb9@byu.net>
parents: 7728
diff changeset
503 /* BSD/OS 4.0.1 has a bug: <stddef.h>, <stdio.h> and <time.h> must be
b6376840b47b * modules/fnmatch (Depends-on): Depend on wchar.
Eric Blake <ebb9@byu.net>
parents: 7728
diff changeset
504 included before <wchar.h>. */
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
505 #include <stddef.h>
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
506 #include <signal.h>
8922
4d1bebb0f82b Linux uClibc built without wide character support lacks <wchar.h>.
Bruno Haible <bruno@clisp.org>
parents: 8911
diff changeset
507 #if HAVE_WCHAR_H
4d1bebb0f82b Linux uClibc built without wide character support lacks <wchar.h>.
Bruno Haible <bruno@clisp.org>
parents: 8911
diff changeset
508 # include <stdio.h>
4d1bebb0f82b Linux uClibc built without wide character support lacks <wchar.h>.
Bruno Haible <bruno@clisp.org>
parents: 8911
diff changeset
509 # include <time.h>
4d1bebb0f82b Linux uClibc built without wide character support lacks <wchar.h>.
Bruno Haible <bruno@clisp.org>
parents: 8911
diff changeset
510 # include <wchar.h>
4d1bebb0f82b Linux uClibc built without wide character support lacks <wchar.h>.
Bruno Haible <bruno@clisp.org>
parents: 8911
diff changeset
511 #endif
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
512 ]])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
513
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
514 dnl gl_STDINT_TYPE_PROPERTIES
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
515 dnl Compute HAVE_SIGNED_t, BITSIZEOF_t and t_SUFFIX, for all the types t
9261
68885f2c5702 Rename stdint_.h to stdint.in.h.
Bruno Haible <bruno@clisp.org>
parents: 9135
diff changeset
516 dnl of interest to stdint.in.h.
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
517 AC_DEFUN([gl_STDINT_TYPE_PROPERTIES],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
518 [
10971
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
519 AC_REQUIRE([gl_MULTIARCH])
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
520 if test $APPLE_UNIVERSAL_BUILD = 0; then
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
521 gl_STDINT_BITSIZEOF([ptrdiff_t size_t],
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
522 [gl_STDINT_INCLUDES])
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
523 fi
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
524 gl_STDINT_BITSIZEOF([sig_atomic_t wchar_t wint_t],
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
525 [gl_STDINT_INCLUDES])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
526 gl_CHECK_TYPES_SIGNED([sig_atomic_t wchar_t wint_t],
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
527 [gl_STDINT_INCLUDES])
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
528 gl_cv_type_ptrdiff_t_signed=yes
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
529 gl_cv_type_size_t_signed=no
10971
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
530 if test $APPLE_UNIVERSAL_BUILD = 0; then
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
531 gl_INTEGER_TYPE_SUFFIX([ptrdiff_t size_t],
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
532 [gl_STDINT_INCLUDES])
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
533 fi
64a20f26c6bd Add support for universal builds to <stdint.h>.
Bruno Haible <bruno@clisp.org>
parents: 9921
diff changeset
534 gl_INTEGER_TYPE_SUFFIX([sig_atomic_t wchar_t wint_t],
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
535 [gl_STDINT_INCLUDES])
15602
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
536
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
537 dnl If wint_t is smaller than 'int', it cannot satisfy the ISO C 99
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
538 dnl requirement that wint_t is "unchanged by default argument promotions".
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
539 dnl In this case gnulib's <wchar.h> and <wctype.h> override wint_t.
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
540 dnl Set the variable BITSIZEOF_WINT_T accordingly.
18610
4e0829b9b9bb stdint: Fix WINT_MAX to match the gnulib provided wint_t on minw.
Bruno Haible <bruno@clisp.org>
parents: 18577
diff changeset
541 if test $GNULIB_OVERRIDES_WINT_T = 1; then
15602
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
542 BITSIZEOF_WINT_T=32
2ef7d0e76b27 Fix wint_t on MSVC.
Bruno Haible <bruno@clisp.org>
parents: 14747
diff changeset
543 fi
6906
b912515df187 Simplification rewrite for stdint module.
Paul Eggert <eggert@cs.ucla.edu>
parents: 6873
diff changeset
544 ])