2 ?RCS: Copyright (c) 2012 Raphael Manfredi
4 ?RCS: You may redistribute only under the terms of the Artistic Licence,
5 ?RCS: as specified in the README file that comes with the distribution.
6 ?RCS: You may reuse parts of this distribution only within the terms of
7 ?RCS: that same Artistic Licence; a copy of which may be found at the root
8 ?RCS: of the source tree for dist 4.0.
10 ?MAKE:ilp d_ilp32 d_ilp64 d_lp64 d_can64: Assert Myread Setvar \
11 cat rm +cc +ccflags echo n c intsize longsize ptrsize
12 ?MAKE: -pick add $@ %<
14 ?S: This variable contains the largest amount of bits that the CPU supports,
15 ?S: from the compiler's point of view. Typically 32 or 64.
18 ?S: This variable conditionally defines the CPU_IS_ILP32.
21 ?S: This variable conditionally defines the CPU_IS_ILP64.
24 ?S: This variable conditionally defines the CPU_IS_LP64.
27 ?S: This variable conditionally defines CAN_HANDLE_64BITS.
30 ?C: This symbol contains the largest amount of bits that the CPU natively
31 ?C: supports from the compiler's point of view. Typically 32 or 64.
34 ?C: When defined, this indicates that the integer, long and pointer variables
35 ?C: hold 32-bit values.
38 ?C: When defined, this indicates that the integer, long and pointer variables
39 ?C: hold 64-bit values.
42 ?C: When defined, this indicates that the long and pointer variables hold
43 ?C: 64-bit values but integers are smaller (probably only 32-bit wide).
46 ?C: When defined, this indicates that the compiler can handle 64-bit values
47 ?C: despite the CPU having only 32-bit registers. These are available using
48 ?C: the "long long" C type. It is only defined for ILP32 machines, since
49 ?C: 64-bit support is naturally available on ILP64 and LP64 machines.
51 ?H:#define CPU_ILP_MAXBITS $ilp
52 ?H:#$d_ilp32 CPU_IS_ILP32 /**/
53 ?H:#$d_ilp64 CPU_IS_ILP64 /**/
54 ?H:#$d_lp64 CPU_IS_LP64 /**/
55 ?H:#$d_can64 CAN_HANDLE_64BITS /**/
57 ?LINT: set d_ilp32 d_ilp64 d_lp64 d_can64
58 : check for architecture type
60 $echo $n "Computing CPU architecture type...$c" >&4
61 ilp=`expr $longsize \* 8`
64 val=$undef; set d_ilp32; eval $setvar
68 val=$define; set d_ilp64; eval $setvar
69 val=$undef; set d_lp64; eval $setvar
73 val=$define; set d_lp64; eval $setvar
74 val=$undef; set d_ilp64; eval $setvar
79 echo " ILP${ilp}." >&4
84 set d_ilp32; eval $setvar
85 val=$undef; set d_ilp64; eval $setvar
86 val=$undef; set d_lp64; eval $setvar
90 @if CAN_HANDLE_64BITS || d_can64
91 : see whether compiler supports 64-bit emulation
97 #include "static_assert.h"
101 STATIC_ASSERT(8 == sizeof(foo));
105 if $cc -c $ccflags try.c >/dev/null 2>&1; then
107 echo "Your compiler also supports 64-bit emulation." >&4