This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Add 5th QUAD type for win32
[metaconfig.git] / U / a_dvisory / quadtype.U
CommitLineData
a38738d1
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:
e746645a 8?MAKE:d_quad quadtype uquadtype quadkind: \
9544e06a 9 longsize intsize d_longlong longlongsize d_int64_t \
dcf40b7d 10 Inhdr Setvar
a38738d1 11?MAKE: -pick add $@ %<
500277eb
JH
12?S:d_quad:
13?S: This variable, if defined, tells that there's a 64-bit integer type,
14?S: quadtype.
15?S:.
a38738d1
JH
16?S:quadtype:
17?S: This variable defines Quad_t to be something like long, int,
18?S: long long, int64_t, or whatever type is used for 64-bit integers.
19?S:.
e746645a 20?S:quadkind:
a38738d1
JH
21?S: This variable, if defined, encodes the type of a quad:
22?S: 1 = int, 2 = long, 3 = long long, 4 = int64_t.
23?S:.
24?S:uquadtype:
25?S: This variable defines Uquad_t to be something like unsigned long,
26?S: unsigned int, unsigned long long, uint64_t, or whatever type is
27?S: used for 64-bit integers.
28?S:.
500277eb
JH
29?C:HAS_QUAD:
30?C: This symbol, if defined, tells that there's a 64-bit integer type,
04c34a22 31?C: Quad_t, and its unsigned counterpart, Uquad_t. QUADKIND will be one
b5b0e301
MB
32?C: of QUAD_IS_INT, QUAD_IS_LONG, QUAD_IS_LONG_LONG, QUAD_IS_INT64_T,
33?C: or QUAD_IS___INT64.
a38738d1 34?C:.
500277eb 35?H:#$d_quad HAS_QUAD /**/
e746645a 36?H:?%<:#ifdef HAS_QUAD
2c1d7300
JH
37?H:?%<:# define Quad_t $quadtype /**/
38?H:?%<:# define Uquad_t $uquadtype /**/
e746645a
JH
39?H:?%<:# define QUADKIND $quadkind /**/
40?H:?%<:# define QUAD_IS_INT 1
41?H:?%<:# define QUAD_IS_LONG 2
42?H:?%<:# define QUAD_IS_LONG_LONG 3
43?H:?%<:# define QUAD_IS_INT64_T 4
b5b0e301 44?H:?%<:# define QUAD_IS___INT64 5
e746645a 45?H:?%<:#endif
a38738d1
JH
46?H:.
47?LINT:set quadtype
48?LINT:set uquadtype
d7a2632b 49: Check if 64bit ints have a quad type
a38738d1 50echo " "
e746645a 51echo "Checking which 64-bit integer type we could use..." >&4
d088635c 52?X: We prefer quad types in order of int, long, long long, int64_t.
a38738d1
JH
53
54case "$intsize" in
558) val=int
56 set quadtype
57 eval $setvar
58 val='"unsigned int"'
59 set uquadtype
60 eval $setvar
e746645a 61 quadkind=1
a38738d1
JH
62 ;;
63*) case "$longsize" in
64 8) val=long
65 set quadtype
66 eval $setvar
67 val='"unsigned long"'
68 set uquadtype
69 eval $setvar
e746645a 70 quadkind=2
a38738d1 71 ;;
d088635c
JH
72 *) case "$d_longlong:$longlongsize" in
73 define:8)
a38738d1
JH
74 val='"long long"'
75 set quadtype
76 eval $setvar
77 val='"unsigned long long"'
78 set uquadtype
79 eval $setvar
e746645a 80 quadkind=3
a38738d1 81 ;;
9544e06a 82 *) case "$d_int64_t" in
a38738d1
JH
83 define)
84 val=int64_t
85 set quadtype
86 eval $setvar
87 val=uint64_t
88 set uquadtype
89 eval $setvar
e746645a 90 quadkind=4
a38738d1
JH
91 ;;
92 esac
93 ;;
94 esac
95 ;;
96 esac
97 ;;
98esac
99
100case "$quadtype" in
2bdc7c0c 101'') echo "Alas, no 64-bit integer types in sight." >&4
500277eb
JH
102 d_quad="$undef"
103 ;;
dcf40b7d 104*) echo "We could use '$quadtype' for 64-bit integers." >&4
500277eb
JH
105 d_quad="$define"
106 ;;
a38738d1
JH
107esac
108