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: | |
0f00356b JH |
10 | ?MAKE:d_longdbl longdblsize: Compile Setvar Myread run \ |
11 | cat rm test doublesize | |
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 | |
959f3c4c JH |
37 | : check for long doubles |
38 | echo " " | |
840deeaa | 39 | echo "Checking to see if you have long double..." >&4 |
a38738d1 JH |
40 | echo 'int main() { long double x = 7.0; }' > try.c |
41 | set try | |
42 | if eval $compile; then | |
959f3c4c | 43 | val="$define" |
1da6d93e | 44 | echo "You have long double." |
959f3c4c JH |
45 | else |
46 | val="$undef" | |
1da6d93e | 47 | echo "You do not have long double." |
959f3c4c JH |
48 | fi |
49 | $rm try.* | |
50 | set d_longdbl | |
51 | eval $setvar | |
52 | ||
53 | @if LONG_DOUBLESIZE || longdblsize | |
54 | : check for length of long double | |
55 | ?X: Check only if d_longdbl and if longdblsize is not already set. | |
56 | case "${d_longdbl}${longdblsize}" in | |
57 | $define) | |
58 | echo " " | |
0fdea05a | 59 | echo "Checking to see how big your long doubles are..." >&4 |
959f3c4c JH |
60 | $cat >try.c <<'EOCP' |
61 | #include <stdio.h> | |
62 | int main() | |
63 | { | |
64 | printf("%d\n", sizeof(long double)); | |
65 | } | |
66 | EOCP | |
67 | set try | |
68 | ?X: Don't use compile_ok because some compilers warn you that they have | |
69 | ?X: 'long double' as just 'double'. | |
a38738d1 | 70 | set try |
959f3c4c | 71 | if eval $compile; then |
0f00356b | 72 | longdblsize=`$run ./try` |
0fdea05a | 73 | echo "Your long doubles are $longdblsize bytes long." |
959f3c4c JH |
74 | else |
75 | dflt='8' | |
76 | echo " " | |
77 | echo "(I can't seem to compile the test program. Guessing...)" >&4 | |
78 | rp="What is the size of a long double (in bytes)?" | |
79 | . ./myread | |
80 | longdblsize="$ans" | |
81 | fi | |
82 | if $test "X$doublesize" = "X$longdblsize"; then | |
15dfe1a4 JH |
83 | echo "That isn't any different from an ordinary double." |
84 | echo "I'll keep your setting anyway, but you may see some" | |
85 | echo "harmless compilation warnings." | |
959f3c4c JH |
86 | fi |
87 | ;; | |
88 | esac | |
a38738d1 | 89 | $rm -f try.* try |
959f3c4c JH |
90 | @end |
91 |