This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Remove trailing whitespace on meta-lines in unit files
[metaconfig.git] / dist / U / ilp.U
1 ?RCS:
2 ?RCS: Copyright (c) 2012 Raphael Manfredi
3 ?RCS:
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.
9 ?RCS:
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 $@ %<
13 ?S:ilp:
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.
16 ?S:.
17 ?S:d_ilp32:
18 ?S:     This variable conditionally defines the CPU_IS_ILP32.
19 ?S:.
20 ?S:d_ilp64:
21 ?S:     This variable conditionally defines the CPU_IS_ILP64.
22 ?S:.
23 ?S:d_lp64:
24 ?S:     This variable conditionally defines the CPU_IS_LP64.
25 ?S:.
26 ?S:d_can64:
27 ?S:     This variable conditionally defines CAN_HANDLE_64BITS.
28 ?S:.
29 ?C:CPU_ILP_MAXBITS:
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.
32 ?C:.
33 ?C:CPU_IS_ILP32:
34 ?C:     When defined, this indicates that the integer, long and pointer variables
35 ?C:     hold 32-bit values.
36 ?C:.
37 ?C:CPU_IS_ILP64:
38 ?C:     When defined, this indicates that the integer, long and pointer variables
39 ?C:     hold 64-bit values.
40 ?C:.
41 ?C:CPU_IS_LP64:
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).
44 ?C:.
45 ?C:CAN_HANDLE_64BITS:
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.
50 ?C:.
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  /**/
56 ?H:.
57 ?LINT: set d_ilp32 d_ilp64 d_lp64 d_can64
58 : check for architecture type
59 echo " "
60 $echo $n "Computing CPU architecture type...$c" >&4
61 ilp=`expr $longsize \* 8`
62 case "$ptrsize" in
63 8)
64         val=$undef; set d_ilp32; eval $setvar
65         case "$intsize" in
66         8)      
67                 echo " ILP64." >&4
68                 val=$define; set d_ilp64; eval $setvar
69                 val=$undef; set d_lp64; eval $setvar
70                 ;;
71         *)
72                 echo " LP64." >&4
73                 val=$define; set d_lp64; eval $setvar
74                 val=$undef; set d_ilp64; eval $setvar
75                 ;;
76         esac
77         ;;
78 *)
79         echo " ILP${ilp}." >&4
80         case "$ilp" in
81         32) val=$define;;
82         *) val=$undef;;
83         esac
84         set d_ilp32; eval $setvar
85         val=$undef; set d_ilp64; eval $setvar
86         val=$undef; set d_lp64; eval $setvar
87         ;;
88 esac
89
90 @if CAN_HANDLE_64BITS || d_can64
91 : see whether compiler supports 64-bit emulation
92 val=$undef
93 case "$ilp" in
94 64) val=$define;;
95 *)
96         $cat >try.c <<EOCP
97 #include "static_assert.h"
98 long long foo;
99 int main()
100 {
101         STATIC_ASSERT(8 == sizeof(foo));
102         return 0;
103 }
104 EOCP
105         if $cc -c $ccflags try.c >/dev/null 2>&1; then
106                 echo " "
107                 echo "Your compiler also supports 64-bit emulation." >&4
108                 val=$define
109         fi
110         $rm -f try.*
111         ;;
112 esac
113 set d_can64
114 eval $setvar
115
116 @end