This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
From: Benny Siegert <bsiegert@gmail.com>
[metaconfig.git] / U / perl / longdblfio.U
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:
8 ?MAKE:d_PRIfldbl sPRIfldbl d_PRIgldbl d_PRIFUldbl sPRIGUldbl d_PRIEUldbl \
9         sPRIgldbl d_PRIeldbl sPRIeldbl sPRIFUldbl d_PRIGUldbl sPRIEUldbl \
10         d_SCNfldbl \
11         sSCNfldbl: \
12         d_longdbl longdblsize doublesize test cat rm_try \
13         Setvar Compile run
14 ?MAKE:  -pick add $@ %<
15 ?S:d_PRIfldbl:
16 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
17 ?S:     indicates that stdio has a symbol to print long doubles.
18 ?S:.
19 ?S:d_PRIgldbl:
20 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
21 ?S:     indicates that stdio has a symbol to print long doubles.
22 ?S:.
23 ?S:d_PRIeldbl:
24 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
25 ?S:     indicates that stdio has a symbol to print long doubles.
26 ?S:.
27 ?S:d_PRIFUldbl:
28 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
29 ?S:     indicates that stdio has a symbol to print long doubles.
30 ?S:     The 'U' in the name is to separate this from d_PRIfldbl so that even
31 ?S:     case-blind systems can see the difference.
32 ?S:.
33 ?S:d_PRIGUldbl:
34 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
35 ?S:     indicates that stdio has a symbol to print long doubles.
36 ?S:     The 'U' in the name is to separate this from d_PRIgldbl so that even
37 ?S:     case-blind systems can see the difference.
38 ?S:.
39 ?S:d_PRIEUldbl:
40 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
41 ?S:     indicates that stdio has a symbol to print long doubles.
42 ?S:     The 'U' in the name is to separate this from d_PRIeldbl so that even
43 ?S:     case-blind systems can see the difference.
44 ?S:.
45 ?S:d_SCNfldbl:
46 ?S:     This variable conditionally defines the PERL_PRIfldbl symbol, which
47 ?S:     indicates that stdio has a symbol to scan long doubles.
48 ?S:.
49 ?S:sPRIfldbl:
50 ?S:     This variable, if defined, contains the string used by stdio to
51 ?S:     format long doubles (format 'f') for output.
52 ?S:.
53 ?S:sPRIgldbl:
54 ?S:     This variable, if defined, contains the string used by stdio to
55 ?S:     format long doubles (format 'g') for output.
56 ?S:.
57 ?S:sPRIeldbl:
58 ?S:     This variable, if defined, contains the string used by stdio to
59 ?S:     format long doubles (format 'e') for output.
60 ?S:.
61 ?S:sPRIFUldbl:
62 ?S:     This variable, if defined, contains the string used by stdio to
63 ?S:     format long doubles (format 'F') for output.
64 ?S:     The 'U' in the name is to separate this from sPRIfldbl so that even
65 ?S:     case-blind systems can see the difference.
66 ?S:.
67 ?S:sPRIGUldbl:
68 ?S:     This variable, if defined, contains the string used by stdio to
69 ?S:     format long doubles (format 'G') for output.
70 ?S:     The 'U' in the name is to separate this from sPRIgldbl so that even
71 ?S:     case-blind systems can see the difference.
72 ?S:.
73 ?S:sPRIEUldbl:
74 ?S:     This variable, if defined, contains the string used by stdio to
75 ?S:     format long doubles (format 'E') for output.
76 ?S:     The 'U' in the name is to separate this from sPRIeldbl so that even
77 ?S:     case-blind systems can see the difference.
78 ?S:.
79 ?S:sSCNfldbl:
80 ?S:     This variable, if defined, contains the string used by stdio to
81 ?S:     format long doubles (format 'f') for input.
82 ?S:.
83 ?C:PERL_PRIfldbl:
84 ?C:     This symbol, if defined, contains the string used by stdio to
85 ?C:     format long doubles (format 'f') for output.
86 ?C:.
87 ?C:PERL_PRIgldbl:
88 ?C:     This symbol, if defined, contains the string used by stdio to
89 ?C:     format long doubles (format 'g') for output.
90 ?C:.
91 ?C:PERL_PRIeldbl:
92 ?C:     This symbol, if defined, contains the string used by stdio to
93 ?C:     format long doubles (format 'e') for output.
94 ?C:.
95 ?C:PERL_PRIFldbl:
96 ?C:     This symbol, if defined, contains the string used by stdio to
97 ?C:     format long doubles (format 'f') for output.
98 ?C:.
99 ?C:PERL_PRIGldbl:
100 ?C:     This symbol, if defined, contains the string used by stdio to
101 ?C:     format long doubles (format 'g') for output.
102 ?C:.
103 ?C:PERL_PRIEldbl:
104 ?C:     This symbol, if defined, contains the string used by stdio to
105 ?C:     format long doubles (format 'e') for output.
106 ?C:.
107 ?C:PERL_SCNfldbl:
108 ?C:     This symbol, if defined, contains the string used by stdio to
109 ?C:     format long doubles (format 'f') for input.
110 ?C:.
111 ?H:#$d_PRIfldbl PERL_PRIfldbl   $sPRIfldbl      /**/
112 ?H:#$d_PRIgldbl PERL_PRIgldbl   $sPRIgldbl      /**/
113 ?H:#$d_PRIeldbl PERL_PRIeldbl   $sPRIeldbl      /**/
114 ?H:#$d_PRIFUldbl PERL_PRIFldbl  $sPRIFUldbl     /**/
115 ?H:#$d_PRIGUldbl PERL_PRIGldbl  $sPRIGUldbl     /**/
116 ?H:#$d_PRIEUldbl PERL_PRIEldbl  $sPRIEUldbl     /**/
117 ?H:#$d_SCNfldbl PERL_SCNfldbl   $sSCNfldbl      /**/
118 ?H:.
119 ?T:yyy
120 ?F:!try
121 : Check print/scan long double stuff
122 echo " "
123
124 if $test X"$d_longdbl" = X"$define"; then
125
126 echo "Checking how to print long doubles..." >&4
127
128 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
129         $cat >try.c <<'EOCP'
130 #include <sys/types.h>
131 #include <stdio.h>
132 int main() {
133   double d = 123.456;
134   printf("%.3f\n", d);
135 }
136 EOCP
137         set try
138         if eval $compile; then
139                 yyy=`$run ./try`
140                 case "$yyy" in
141                 123.456)
142                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
143                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
144                         echo "We will use %f."
145                         ;;
146                 esac
147         fi
148 fi
149
150 if $test X"$sPRIfldbl" = X; then
151         $cat >try.c <<'EOCP'
152 #include <sys/types.h>
153 #include <stdio.h>
154 int main() {
155   long double d = 123.456;
156   printf("%.3Lf\n", d);
157 }
158 EOCP
159         set try
160         if eval $compile; then
161                 yyy=`$run ./try`
162                 case "$yyy" in
163                 123.456)
164                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
165                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
166                         echo "We will use %Lf."
167                         ;;
168                 esac
169         fi
170 fi
171
172 if $test X"$sPRIfldbl" = X; then
173         $cat >try.c <<'EOCP'
174 #include <sys/types.h>
175 #include <stdio.h>
176 int main() {
177   long double d = 123.456;
178   printf("%.3llf\n", d);
179 }
180 EOCP
181         set try
182         if eval $compile; then
183                 yyy=`$run ./try`
184                 case "$yyy" in
185                 123.456)
186                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
187                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
188                         echo "We will use %llf."
189                         ;;
190                 esac
191         fi
192 fi
193
194 if $test X"$sPRIfldbl" = X; then
195         $cat >try.c <<'EOCP'
196 #include <sys/types.h>
197 #include <stdio.h>
198 int main() {
199   long double d = 123.456;
200   printf("%.3lf\n", d);
201 }
202 EOCP
203         set try
204         if eval $compile; then
205                 yyy=`$run ./try`
206                 case "$yyy" in
207                 123.456)
208                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
209                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
210                         echo "We will use %lf."
211                         ;;
212                 esac
213         fi
214 fi
215
216 if $test X"$sPRIfldbl" = X; then
217         echo "Cannot figure out how to print long doubles." >&4
218 else
219         sSCNfldbl=$sPRIfldbl    # expect consistency
220 fi
221
222 $rm_try
223
224 fi # d_longdbl
225
226 case "$sPRIfldbl" in
227 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef";
228         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef";
229         d_SCNfldbl="$undef";
230         ;;
231 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define";
232         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define";
233         d_SCNfldbl="$define";
234         ;;
235 esac
236