This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / quadfio.U
CommitLineData
cd276bb8
JH
1?RCS: $Id$
2?RCS:
3?RCS: Copyright (c) 1999 Jarkko Hietaniemi
4?RCS:
5?RCS: You may distribute under the terms of either the GNU General Public
6?RCS: License or the Artistic License, as specified in the README file.
7?RCS:
3bb42500
JH
8?MAKE:d_PRId64 d_PRIi64 d_PRIu64 d_PRIo64 d_PRIx64 d_PRIXU64 \
9 sPRId64 sPRIi64 sPRIu64 sPRIo64 sPRIx64 sPRIXU64: \
2cb64bf6 10 quadtype i_inttypes test cat rm_try Setvar Compile run
cd276bb8
JH
11?MAKE: -pick add $@ %<
12?S:d_PRId64:
13?S: This variable conditionally defines the PERL_PRId64 symbol, which
4dd7201d 14?S: indicates that stdio has a symbol to print 64-bit decimal numbers.
cd276bb8
JH
15?S:.
16?S:d_PRIi64:
17?S: This variable conditionally defines the PERL_PRIi64 symbol, which
4dd7201d 18?S: indicates that stdio has a symbol to print 64-bit decimal numbers.
cd276bb8
JH
19?S:.
20?S:d_PRIu64:
21?S: This variable conditionally defines the PERL_PRIu64 symbol, which
4dd7201d 22?S: indicates that stdio has a symbol to print 64-bit unsigned decimal
cd276bb8
JH
23?S: numbers.
24?S:.
25?S:d_PRIo64:
26?S: This variable conditionally defines the PERL_PRIo64 symbol, which
4dd7201d 27?S: indicates that stdio has a symbol to print 64-bit octal numbers.
cd276bb8
JH
28?S:.
29?S:d_PRIx64:
30?S: This variable conditionally defines the PERL_PRIx64 symbol, which
4dd7201d 31?S: indicates that stdio has a symbol to print 64-bit hexadecimal numbers.
cd276bb8 32?S:.
3bb42500
JH
33?S:d_PRIXU64:
34?S: This variable conditionally defines the PERL_PRIXU64 symbol, which
4dd7201d 35?S: indicates that stdio has a symbol to print 64-bit hExADECimAl numbers.
3bb42500
JH
36?S: The 'U' in the name is to separate this from d_PRIx64 so that even
37?S: case-blind systems can see the difference.
cd276bb8
JH
38?S:.
39?S:sPRId64:
40?S: This variable, if defined, contains the string used by stdio to
41?S: format 64-bit decimal numbers (format 'd') for output.
42?S:.
43?S:sPRIi64:
44?S: This variable, if defined, contains the string used by stdio to
45?S: format 64-bit decimal numbers (format 'i') for output.
46?S:.
47?S:sPRIu64:
48?S: This variable, if defined, contains the string used by stdio to
49?S: format 64-bit unsigned decimal numbers (format 'u') for output.
50?S:.
51?S:sPRIo64:
52?S: This variable, if defined, contains the string used by stdio to
53?S: format 64-bit octal numbers (format 'o') for output.
54?S:.
55?S:sPRIx64:
56?S: This variable, if defined, contains the string used by stdio to
57?S: format 64-bit hexadecimal numbers (format 'x') for output.
58?S:.
3bb42500 59?S:sPRIXU64:
cd276bb8
JH
60?S: This variable, if defined, contains the string used by stdio to
61?S: format 64-bit hExADECimAl numbers (format 'X') for output.
3bb42500
JH
62?S: The 'U' in the name is to separate this from sPRIx64 so that even
63?S: case-blind systems can see the difference.
cd276bb8
JH
64?S:.
65?C:PERL_PRId64:
66?C: This symbol, if defined, contains the string used by stdio to
67?C: format 64-bit decimal numbers (format 'd') for output.
68?C:.
69?C:PERL_PRIi64:
70?C: This symbol, if defined, contains the string used by stdio to
71?C: format 64-bit decimal numbers (format 'i') for output.
72?C:.
73?C:PERL_PRIu64:
74?C: This symbol, if defined, contains the string used by stdio to
75?C: format 64-bit unsigned decimal numbers (format 'u') for output.
76?C:.
77?C:PERL_PRIo64:
78?C: This symbol, if defined, contains the string used by stdio to
79?C: format 64-bit octal numbers (format 'o') for output.
80?C:.
81?C:PERL_PRIx64:
82?C: This symbol, if defined, contains the string used by stdio to
83?C: format 64-bit hexadecimal numbers (format 'x') for output.
84?C:.
3bb42500 85?C:PERL_PRIXU64:
cd276bb8
JH
86?C: This symbol, if defined, contains the string used by stdio to
87?C: format 64-bit hExADECimAl numbers (format 'X') for output.
88?C:.
89?H:#$d_PRId64 PERL_PRId64 $sPRId64 /**/
90?H:#$d_PRIi64 PERL_PRIi64 $sPRIi64 /**/
91?H:#$d_PRIu64 PERL_PRIu64 $sPRIu64 /**/
92?H:#$d_PRIo64 PERL_PRIo64 $sPRIo64 /**/
93?H:#$d_PRIx64 PERL_PRIx64 $sPRIx64 /**/
3bb42500 94?H:#$d_PRIx64 PERL_PRIXU64 $sPRIXU64 /**/
cd276bb8 95?H:.
a38738d1 96?T:yyy
0065f4af
MB
97?F:!try
98: Check 64bit sizes
cd276bb8
JH
99echo " "
100
a38738d1 101if $test X"$quadtype" != X; then
cd276bb8
JH
102
103echo "Checking how to print 64-bit integers..." >&4
104
a38738d1 105if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
cd276bb8
JH
106 $cat >try.c <<'EOCP'
107#include <sys/types.h>
108#include <stdio.h>
109int main() {
110 int q = 12345678901;
111 printf("%ld\n", q);
112}
113EOCP
114 set try
115 if eval $compile; then
0f00356b 116 yyy=`$run ./try`
cd276bb8
JH
117 case "$yyy" in
118 12345678901)
119 sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
3bb42500 120 sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
cd276bb8
JH
121 echo "We will use %d."
122 ;;
123 esac
124 fi
125fi
126
a38738d1 127if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
cd276bb8
JH
128 $cat >try.c <<'EOCP'
129#include <sys/types.h>
130#include <stdio.h>
131int main() {
132 long q = 12345678901;
133 printf("%ld\n", q);
134}
135EOCP
136 set try
137 if eval $compile; then
0f00356b 138 yyy=`$run ./try`
cd276bb8
JH
139 case "$yyy" in
140 12345678901)
141 sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
3bb42500 142 sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
cd276bb8
JH
143 echo "We will use %ld."
144 ;;
145 esac
146 fi
147fi
148
508a21cd 149if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
cd276bb8
JH
150 $cat >try.c <<'EOCP'
151#include <sys/types.h>
152#include <inttypes.h>
153#include <stdio.h>
154int main() {
155 int64_t q = 12345678901;
156 printf("%" PRId64 "\n", q);
157}
158EOCP
159 set try
160 if eval $compile; then
0f00356b 161 yyy=`$run ./try`
cd276bb8
JH
162 case "$yyy" in
163 12345678901)
164 sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
3bb42500 165 sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
cd276bb8
JH
166 echo "We will use the C9X style."
167 ;;
168 esac
169 fi
170fi
171
7857a0f2
JH
172if $test X"$sPRId64" = X -a X"$quadtype" != X; then
173 $cat >try.c <<EOCP
cd276bb8
JH
174#include <sys/types.h>
175#include <stdio.h>
176int main() {
7857a0f2
JH
177 $quadtype q = 12345678901;
178 printf("%Ld\n", q);
cd276bb8
JH
179}
180EOCP
181 set try
182 if eval $compile; then
0f00356b 183 yyy=`$run ./try`
cd276bb8
JH
184 case "$yyy" in
185 12345678901)
7857a0f2
JH
186 sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
187 sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
188 echo "We will use %Ld."
cd276bb8
JH
189 ;;
190 esac
191 fi
192fi
193
7857a0f2
JH
194if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
195 $cat >try.c <<'EOCP'
cd276bb8
JH
196#include <sys/types.h>
197#include <stdio.h>
198int main() {
7857a0f2
JH
199 long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
200 printf("%lld\n", q);
cd276bb8
JH
201}
202EOCP
203 set try
204 if eval $compile; then
0f00356b 205 yyy=`$run ./try`
cd276bb8
JH
206 case "$yyy" in
207 12345678901)
7857a0f2
JH
208 sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
209 sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
210 echo "We will use the %lld style."
cd276bb8
JH
211 ;;
212 esac
213 fi
214fi
215
a38738d1 216if $test X"$sPRId64" = X -a X"$quadtype" != X; then
cd276bb8
JH
217 $cat >try.c <<EOCP
218#include <sys/types.h>
219#include <stdio.h>
220int main() {
a38738d1 221 $quadtype q = 12345678901;
cd276bb8
JH
222 printf("%qd\n", q);
223}
224EOCP
225 set try
226 if eval $compile; then
0f00356b 227 yyy=`$run ./try`
cd276bb8
JH
228 case "$yyy" in
229 12345678901)
230 sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
3bb42500 231 sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
cd276bb8
JH
232 echo "We will use %qd."
233 ;;
234 esac
235 fi
236fi
237
238if $test X"$sPRId64" = X; then
239 echo "Cannot figure out how to print 64-bit integers." >&4
240fi
2cb64bf6 241$rm_try
606846d3 242
a38738d1 243fi
cd276bb8
JH
244
245case "$sPRId64" in
2cb64bf6
MB
246'') d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef";
247 d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef";
cd276bb8 248 ;;
2cb64bf6
MB
249*) d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define";
250 d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define";
cd276bb8
JH
251 ;;
252esac
253