Mercurial > hg > octave-kai > gnulib-hg
annotate m4/inttypes.m4 @ 13066:fc8c984b0733
Factorize common .m4 code.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Sat, 27 Mar 2010 18:38:53 +0100 |
parents | 2c14f1e449e5 |
children | 97fc9a21a8fb |
rev | line source |
---|---|
13066
fc8c984b0733
Factorize common .m4 code.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
1 # inttypes.m4 serial 18 |
12559
c2cbabec01dd
update nearly all FSF copyright year lists to include 2010
Jim Meyering <meyering@redhat.com>
parents:
12536
diff
changeset
|
2 dnl Copyright (C) 2006-2010 Free Software Foundation, Inc. |
7204 | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | |
5 dnl with or without modifications, as long as this notice is preserved. | |
6 | |
7 dnl From Derek Price, Bruno Haible. | |
8 dnl Test whether <inttypes.h> is supported or must be substituted. | |
9 | |
10 AC_DEFUN([gl_INTTYPES_H], | |
11 [ | |
12 AC_REQUIRE([gl_STDINT_H]) | |
13 AC_REQUIRE([gt_INTTYPES_PRI]) | |
12563
21ecefd9dc81
headers: make check of system header explicit
Eric Blake <ebb9@byu.net>
parents:
12559
diff
changeset
|
14 AC_CHECK_HEADERS_ONCE([inttypes.h]) |
7204 | 15 AC_CHECK_DECLS_ONCE([imaxabs]) |
16 AC_CHECK_DECLS_ONCE([imaxdiv]) | |
17 AC_CHECK_DECLS_ONCE([strtoimax]) | |
18 AC_CHECK_DECLS_ONCE([strtoumax]) | |
19 | |
20 dnl Now see if we need a substitute <inttypes.h>. | |
21 dnl A complete <inttypes.h> requires | |
22 dnl - a complete <stdint.h>, | |
23 dnl - the existence of an <inttypes.h>, | |
24 dnl - that imaxabs, imaxdiv, strtoimax, strtoumax are declared, | |
25 dnl - some additional tests. | |
7657
60d54899043e
* m4/inttypes.m4 (gl_INTTYPES_H): Use AC_CACHE_CHECK so that the
Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
parents:
7330
diff
changeset
|
26 AC_CACHE_CHECK([whether inttypes.h conforms to C99], |
7658
7ac7691c20b6
Reindent for consistency.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7657
diff
changeset
|
27 [gl_cv_header_working_inttypes_h], |
7ac7691c20b6
Reindent for consistency.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7657
diff
changeset
|
28 [gl_cv_header_working_inttypes_h=no |
7ac7691c20b6
Reindent for consistency.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7657
diff
changeset
|
29 if test "$gl_cv_header_working_stdint_h" = yes \ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
30 && test $ac_cv_header_inttypes_h = yes \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
31 && test "$ac_cv_have_decl_imaxabs" = yes \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
32 && test "$ac_cv_have_decl_imaxdiv" = yes \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
33 && test "$ac_cv_have_decl_strtoimax" = yes \ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
34 && test "$ac_cv_have_decl_strtoumax" = yes; then |
7658
7ac7691c20b6
Reindent for consistency.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7657
diff
changeset
|
35 AC_COMPILE_IFELSE([ |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
36 AC_LANG_PROGRAM([[ |
7204 | 37 #include <stddef.h> |
38 #define __STDC_LIMIT_MACROS 1 /* to make it work also in C++ mode */ | |
39 #define __STDC_CONSTANT_MACROS 1 /* to make it work also in C++ mode */ | |
40 #define __STDC_FORMAT_MACROS 1 /* to make it work also in C++ mode */ | |
8995
1025663f7658
* m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents:
8185
diff
changeset
|
41 #define _GL_JUST_INCLUDE_SYSTEM_INTTYPES_H /* work if build isn't clean */ |
1025663f7658
* m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents:
8185
diff
changeset
|
42 #include <inttypes.h> |
7204 | 43 |
44 /* No need to duplicate the tests of stdint.m4; they are subsumed by | |
45 $gl_cv_header_working_stdint_h = yes. */ | |
46 | |
47 /* Tests for macros supposed to be defined in inttypes.h. */ | |
48 | |
49 const char *k = /* implicit string concatenation */ | |
50 #ifdef INT8_MAX | |
51 PRId8 PRIi8 | |
52 #endif | |
53 #ifdef UINT8_MAX | |
54 PRIo8 PRIu8 PRIx8 PRIX8 | |
55 #endif | |
56 #ifdef INT16_MAX | |
57 PRId16 PRIi16 | |
58 #endif | |
59 #ifdef UINT16_MAX | |
60 PRIo16 PRIu16 PRIx16 PRIX16 | |
61 #endif | |
62 #ifdef INT32_MAX | |
63 PRId32 PRIi32 | |
64 #endif | |
65 #ifdef UINT32_MAX | |
66 PRIo32 PRIu32 PRIx32 PRIX32 | |
7224
c42a57e8d187
* inttypes.m4 (gl_INTTYPES_H): Fix missing #endif.
Eric Blake <ebb9@byu.net>
parents:
7223
diff
changeset
|
67 #endif |
7204 | 68 #ifdef INT64_MAX |
69 PRId64 PRIi64 | |
70 #endif | |
71 #ifdef UINT64_MAX | |
72 PRIo64 PRIu64 PRIx64 PRIX64 | |
73 #endif | |
74 PRIdLEAST8 PRIiLEAST8 PRIoLEAST8 PRIuLEAST8 PRIxLEAST8 PRIXLEAST8 | |
75 PRIdLEAST16 PRIiLEAST16 PRIoLEAST16 PRIuLEAST16 PRIxLEAST16 PRIXLEAST16 | |
76 PRIdLEAST32 PRIiLEAST32 PRIoLEAST32 PRIuLEAST32 PRIxLEAST32 PRIXLEAST32 | |
77 PRIdLEAST64 PRIiLEAST64 | |
78 PRIoLEAST64 PRIuLEAST64 PRIxLEAST64 PRIXLEAST64 | |
79 PRIdFAST8 PRIiFAST8 PRIoFAST8 PRIuFAST8 PRIxFAST8 PRIXFAST8 | |
80 PRIdFAST16 PRIiFAST16 PRIoFAST16 PRIuFAST16 PRIxFAST16 PRIXFAST16 | |
81 PRIdFAST32 PRIiFAST32 PRIoFAST32 PRIuFAST32 PRIxFAST32 PRIXFAST32 | |
82 PRIdFAST64 PRIiFAST64 | |
83 PRIoFAST64 PRIuFAST64 PRIxFAST64 PRIXFAST64 | |
84 PRIdMAX PRIiMAX PRIoMAX PRIuMAX PRIxMAX PRIXMAX | |
85 #ifdef INTPTR_MAX | |
86 PRIdPTR PRIiPTR | |
87 #endif | |
88 #ifdef UINTPTR_MAX | |
89 PRIoPTR PRIuPTR PRIxPTR PRIXPTR | |
90 #endif | |
91 ; | |
92 const char *l = /* implicit string concatenation */ | |
93 #ifdef INT8_MAX | |
94 SCNd8 SCNi8 | |
95 #endif | |
96 #ifdef UINT8_MAX | |
7219 | 97 SCNo8 SCNu8 SCNx8 |
7204 | 98 #endif |
99 #ifdef INT16_MAX | |
100 SCNd16 SCNi16 | |
101 #endif | |
102 #ifdef UINT16_MAX | |
7219 | 103 SCNo16 SCNu16 SCNx16 |
7204 | 104 #endif |
105 #ifdef INT32_MAX | |
106 SCNd32 SCNi32 | |
107 #endif | |
108 #ifdef UINT32_MAX | |
7219 | 109 SCNo32 SCNu32 SCNx32 |
7204 | 110 #endif |
111 #ifdef INT64_MAX | |
112 SCNd64 SCNi64 | |
113 #endif | |
114 #ifdef UINT64_MAX | |
7219 | 115 SCNo64 SCNu64 SCNx64 |
7204 | 116 #endif |
7219 | 117 SCNdLEAST8 SCNiLEAST8 SCNoLEAST8 SCNuLEAST8 SCNxLEAST8 |
118 SCNdLEAST16 SCNiLEAST16 SCNoLEAST16 SCNuLEAST16 SCNxLEAST16 | |
119 SCNdLEAST32 SCNiLEAST32 SCNoLEAST32 SCNuLEAST32 SCNxLEAST32 | |
7204 | 120 SCNdLEAST64 SCNiLEAST64 |
7219 | 121 SCNoLEAST64 SCNuLEAST64 SCNxLEAST64 |
122 SCNdFAST8 SCNiFAST8 SCNoFAST8 SCNuFAST8 SCNxFAST8 | |
123 SCNdFAST16 SCNiFAST16 SCNoFAST16 SCNuFAST16 SCNxFAST16 | |
124 SCNdFAST32 SCNiFAST32 SCNoFAST32 SCNuFAST32 SCNxFAST32 | |
7204 | 125 SCNdFAST64 SCNiFAST64 |
7219 | 126 SCNoFAST64 SCNuFAST64 SCNxFAST64 |
127 SCNdMAX SCNiMAX SCNoMAX SCNuMAX SCNxMAX | |
7204 | 128 #ifdef INTPTR_MAX |
129 SCNdPTR SCNiPTR | |
130 #endif | |
131 #ifdef UINTPTR_MAX | |
7219 | 132 SCNoPTR SCNuPTR SCNxPTR |
7204 | 133 #endif |
134 ; | |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
135 ]])], |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
136 [gl_cv_header_working_inttypes_h=yes]) |
7658
7ac7691c20b6
Reindent for consistency.
Paul Eggert <eggert@cs.ucla.edu>
parents:
7657
diff
changeset
|
137 fi]) |
8185
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
138 |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
139 dnl Override <inttypes.h> always, so that the portability warnings work. |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
140 AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
141 gl_CHECK_NEXT_HEADERS([inttypes.h]) |
7204 | 142 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
143 AC_REQUIRE([gl_MULTIARCH]) |
10972
cf1b1ca0bb08
Add support for universal builds to <inttypes.h>.
Bruno Haible <bruno@clisp.org>
parents:
9921
diff
changeset
|
144 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
145 dnl Ensure that <stdint.h> defines the limit macros, since gnulib's |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
146 dnl <inttypes.h> relies on them. This macro is only needed when a |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
147 dnl C++ compiler is in use; it has no effect for a C compiler. |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
148 dnl Also be careful to define __STDC_LIMIT_MACROS only when gnulib's |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
149 dnl <inttypes.h> is going to be created, and to avoid redefinition warnings |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
150 dnl if the __STDC_LIMIT_MACROS is already defined through the CPPFLAGS. |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
151 AC_DEFINE([GL_TRIGGER_STDC_LIMIT_MACROS], [1], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
152 [Define to make the limit macros in <stdint.h> visible.]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
153 AH_VERBATIM([__STDC_LIMIT_MACROS_ZZZ], |
9039
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
154 [/* Ensure that <stdint.h> defines the limit macros, since gnulib's |
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
155 <inttypes.h> relies on them. */ |
9139
c68fd65692fd
Avoid gcc warning: "__STDC_LIMIT_MACROS_TRIGGER" redefined
Bruno Haible <bruno@clisp.org>
parents:
9039
diff
changeset
|
156 #if defined __cplusplus && !defined __STDC_LIMIT_MACROS && GL_TRIGGER_STDC_LIMIT_MACROS |
9039
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
157 # define __STDC_LIMIT_MACROS 1 |
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
158 #endif |
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
159 ]) |
c2aa15b918a5
Ensure that <stdint.h> defines all the *_MAX and *_MIN macros that gnulib's
Bruno Haible <bruno@clisp.org>
parents:
8995
diff
changeset
|
160 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
161 PRIPTR_PREFIX= |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
162 if test -n "$STDINT_H"; then |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
163 dnl Using the gnulib <stdint.h>. It always defines intptr_t to 'long'. |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
164 PRIPTR_PREFIX='"l"' |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
165 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
166 dnl Using the system's <stdint.h>. |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
167 for glpfx in '' l ll I64; do |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
168 case $glpfx in |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
169 '') gltype1='int';; |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
170 l) gltype1='long int';; |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
171 ll) gltype1='long long int';; |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
172 I64) gltype1='__int64';; |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
173 esac |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
174 AC_COMPILE_IFELSE( |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
175 [AC_LANG_PROGRAM([[#include <stdint.h> |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
176 extern intptr_t foo; |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
177 extern $gltype1 foo;]])], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
178 [PRIPTR_PREFIX='"'$glpfx'"']) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
179 test -n "$PRIPTR_PREFIX" && break |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
180 done |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
181 fi |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
182 AC_SUBST([PRIPTR_PREFIX]) |
7204 | 183 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
184 if test "$ac_cv_have_decl_imaxabs" = yes; then |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
185 HAVE_DECL_IMAXABS=1 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
186 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
187 HAVE_DECL_IMAXABS=0 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
188 fi |
7204 | 189 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
190 if test "$ac_cv_have_decl_imaxdiv" = yes; then |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
191 HAVE_DECL_IMAXDIV=1 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
192 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
193 HAVE_DECL_IMAXDIV=0 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
194 fi |
7204 | 195 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
196 if test "$ac_cv_have_decl_strtoimax" = yes; then |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
197 HAVE_DECL_STRTOIMAX=1 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
198 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
199 HAVE_DECL_STRTOIMAX=0 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
200 fi |
7204 | 201 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
202 if test "$ac_cv_have_decl_strtoumax" = yes; then |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
203 HAVE_DECL_STRTOUMAX=1 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
204 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
205 HAVE_DECL_STRTOUMAX=0 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
206 fi |
7204 | 207 |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
208 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
209 [INT32_MAX_LT_INTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
210 [defined INT32_MAX && defined INTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
211 [INT32_MAX < INTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
212 [sizeof (int) < sizeof (long long int)]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
213 if test $APPLE_UNIVERSAL_BUILD = 0; then |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
214 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
215 [INT64_MAX_EQ_LONG_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
216 [defined INT64_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
217 [INT64_MAX == LONG_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
218 [sizeof (long long int) == sizeof (long int)]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
219 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
220 INT64_MAX_EQ_LONG_MAX=-1 |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
221 fi |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
222 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
223 [UINT32_MAX_LT_UINTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
224 [defined UINT32_MAX && defined UINTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
225 [UINT32_MAX < UINTMAX_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
226 [sizeof (unsigned int) < sizeof (unsigned long long int)]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
227 if test $APPLE_UNIVERSAL_BUILD = 0; then |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
228 gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION( |
12536
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
229 [UINT64_MAX_EQ_ULONG_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
230 [defined UINT64_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
231 [UINT64_MAX == ULONG_MAX], |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
232 [sizeof (unsigned long long int) == sizeof (unsigned long int)]) |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
233 else |
cd64e80f94e4
link-warning: always build headers with link warnings
Eric Blake <ebb9@byu.net>
parents:
12421
diff
changeset
|
234 UINT64_MAX_EQ_ULONG_MAX=-1 |
7204 | 235 fi |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12563
diff
changeset
|
236 |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12563
diff
changeset
|
237 dnl Check for declarations of anything we want to poison if the |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12563
diff
changeset
|
238 dnl corresponding gnulib module is not in use. |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12563
diff
changeset
|
239 gl_WARN_ON_USE_PREPARE([[#include <inttypes.h> |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12563
diff
changeset
|
240 ]], [imaxabs imaxdiv strtoimax strtoumax]) |
7204 | 241 ]) |
8185
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
242 |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
243 # Define the symbol $1 to be 1 if the condition is true, 0 otherwise. |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
244 # If $2 is true, the condition is $3; otherwise if long long int is supported |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
245 # approximate the condition with $4; otherwise, assume the condition is false. |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
246 # The condition should work on all C99 platforms; the approximations should be |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
247 # good enough to work on all practical pre-C99 platforms. |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
248 # $2 is evaluated by the C preprocessor, $3 and $4 as compile-time constants. |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
249 AC_DEFUN([gl_INTTYPES_CHECK_LONG_LONG_INT_CONDITION], |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
250 [ |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
251 AC_CACHE_CHECK([whether $3], |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
252 [gl_cv_test_$1], |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
253 [AC_COMPILE_IFELSE( |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
254 [AC_LANG_PROGRAM( |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
255 [[/* Work also in C++ mode. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
256 #define __STDC_LIMIT_MACROS 1 |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
257 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
258 /* Work if build is not clean. */ |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
259 #define _GL_JUST_INCLUDE_SYSTEM_STDINT_H |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
260 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
261 #include <limits.h> |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
262 #if HAVE_STDINT_H |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
263 #include <stdint.h> |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
264 #endif |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
265 |
12421
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
266 #if $2 |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
267 #define CONDITION ($3) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
268 #elif HAVE_LONG_LONG_INT |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
269 #define CONDITION ($4) |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
270 #else |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
271 #define CONDITION 0 |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
272 #endif |
e8d2c6fc33ad
Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents:
11007
diff
changeset
|
273 int test[CONDITION ? 1 : -1];]])], |
9473
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
274 [gl_cv_test_$1=yes], |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
275 [gl_cv_test_$1=no])]) |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
276 if test $gl_cv_test_$1 = yes; then |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
277 $1=1; |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
278 else |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
279 $1=0; |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
280 fi |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
281 AC_SUBST([$1]) |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
282 ]) |
8c3f82d802ec
Don't insist on 'long long int' support in the preprocessor. It
Paul Eggert <eggert@cs.ucla.edu>
parents:
9139
diff
changeset
|
283 |
8185
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
284 AC_DEFUN([gl_INTTYPES_MODULE_INDICATOR], |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
285 [ |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
286 dnl Use AC_REQUIRE here, so that the default settings are expanded once only. |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
287 AC_REQUIRE([gl_INTTYPES_H_DEFAULTS]) |
13066
fc8c984b0733
Factorize common .m4 code.
Bruno Haible <bruno@clisp.org>
parents:
12766
diff
changeset
|
288 gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
8185
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
289 ]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
290 |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
291 AC_DEFUN([gl_INTTYPES_H_DEFAULTS], |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
292 [ |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
293 GNULIB_IMAXABS=0; AC_SUBST([GNULIB_IMAXABS]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
294 GNULIB_IMAXDIV=0; AC_SUBST([GNULIB_IMAXDIV]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
295 GNULIB_STRTOIMAX=0; AC_SUBST([GNULIB_STRTOIMAX]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
296 GNULIB_STRTOUMAX=0; AC_SUBST([GNULIB_STRTOUMAX]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
297 dnl Assume proper GNU behavior unless another module says otherwise. |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
298 HAVE_DECL_IMAXABS=1; AC_SUBST([HAVE_DECL_IMAXABS]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
299 HAVE_DECL_IMAXDIV=1; AC_SUBST([HAVE_DECL_IMAXDIV]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
300 HAVE_DECL_STRTOIMAX=1; AC_SUBST([HAVE_DECL_STRTOIMAX]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
301 HAVE_DECL_STRTOUMAX=1; AC_SUBST([HAVE_DECL_STRTOUMAX]) |
a1e147e70a3b
Emit linker warnings for imaxabs, imaxdiv, strtoimax, strtoumax when these
Bruno Haible <bruno@clisp.org>
parents:
7658
diff
changeset
|
302 ]) |