Commit | Line | Data |
---|---|---|
959f3c4c JH |
1 | ?RCS: $Id: d_longdbl.U,v $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1998 Andy Dougherty | |
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: | |
8 | ?RCS: $Log: d_longdbl.U,v $ | |
9 | ?RCS: | |
a38738d1 JH |
10 | ?MAKE:d_longdbl longdblsize: Compile Setvar Myread \ |
11 | echo n c cat rm test doublesize exe_ext | |
959f3c4c JH |
12 | ?MAKE: -pick add $@ %< |
13 | ?S:d_longdbl: | |
14 | ?S: This variable conditionally defines HAS_LONG_DOUBLE if | |
15 | ?S: the long double type is supported. | |
16 | ?S:. | |
17 | ?S:longdblsize: | |
18 | ?S: This variable contains the value of the LONG_DOUBLESIZE symbol, which | |
19 | ?S: indicates to the C program how many bytes there are in a long double, | |
20 | ?S: if this system supports long doubles. | |
21 | ?S:. | |
22 | ?C:HAS_LONG_DOUBLE: | |
23 | ?C: This symbol will be defined if the C compiler supports long | |
24 | ?C: doubles. | |
25 | ?C:. | |
26 | ?C:LONG_DOUBLESIZE: | |
27 | ?C: This symbol contains the size of a long double, so that the | |
28 | ?C: C preprocessor can make decisions based on it. It is only | |
29 | ?C: defined if the system supports long doubles. | |
30 | ?C:. | |
31 | ?H:#$d_longdbl HAS_LONG_DOUBLE /**/ | |
32 | ?H:?LONG_DOUBLESIZE:#ifdef HAS_LONG_DOUBLE | |
33 | ?H:?LONG_DOUBLESIZE:#define LONG_DOUBLESIZE $longdblsize /**/ | |
34 | ?H:?LONG_DOUBLESIZE:#endif | |
35 | ?H:. | |
36 | ?LINT:set d_longdbl | |
37 | ?F:!try | |
38 | : check for long doubles | |
39 | echo " " | |
a38738d1 JH |
40 | $echo $n "Checking to see if your system supports long double..." $c >&4 |
41 | echo 'int main() { long double x = 7.0; }' > try.c | |
42 | set try | |
43 | if eval $compile; then | |
959f3c4c | 44 | val="$define" |
1da6d93e JH |
45 | echo " " >&4 |
46 | echo "You have long double." | |
959f3c4c JH |
47 | else |
48 | val="$undef" | |
1da6d93e JH |
49 | echo " " >&4 |
50 | echo "You do not have long double." | |
959f3c4c JH |
51 | fi |
52 | $rm try.* | |
53 | set d_longdbl | |
54 | eval $setvar | |
55 | ||
56 | @if LONG_DOUBLESIZE || longdblsize | |
57 | : check for length of long double | |
58 | ?X: Check only if d_longdbl and if longdblsize is not already set. | |
59 | case "${d_longdbl}${longdblsize}" in | |
60 | $define) | |
61 | echo " " | |
a38738d1 | 62 | $echo $n "Checking to see how big your long doubles are..." $c >&4 |
959f3c4c JH |
63 | $cat >try.c <<'EOCP' |
64 | #include <stdio.h> | |
65 | int main() | |
66 | { | |
67 | printf("%d\n", sizeof(long double)); | |
68 | } | |
69 | EOCP | |
70 | set try | |
71 | ?X: Don't use compile_ok because some compilers warn you that they have | |
72 | ?X: 'long double' as just 'double'. | |
a38738d1 | 73 | set try |
959f3c4c | 74 | if eval $compile; then |
a38738d1 | 75 | longdblsize=`./try$exe_ext` |
959f3c4c JH |
76 | $echo " $longdblsize bytes." >&4 |
77 | else | |
78 | dflt='8' | |
79 | echo " " | |
80 | echo "(I can't seem to compile the test program. Guessing...)" >&4 | |
81 | rp="What is the size of a long double (in bytes)?" | |
82 | . ./myread | |
83 | longdblsize="$ans" | |
84 | fi | |
85 | if $test "X$doublesize" = "X$longdblsize"; then | |
86 | echo "(That isn't any different from an ordinary double.)" | |
87 | fi | |
88 | ;; | |
89 | esac | |
a38738d1 | 90 | $rm -f try.* try |
959f3c4c JH |
91 | @end |
92 |