This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
fix .gitignore: only ignore 'perl' in root of repo, not U/perl subdir
[metaconfig.git] / U / perl / d_printfed.U
1 ?RCS: $Id$
2 ?RCS:
3 ?RCS: Copyright (c) 2000 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_printf_exp_digits: Compile cat rm run
9 ?MAKE:  -pick add $@ %<
10 ?S:d_printf_exp_digits:
11 ?S:     This symbol's value is either 2 or 3, corresponding to the
12 ?S:     number of exponent digits produced by the system's sprintf %[FGfg]
13 ?S:     formats when the modulus of the exponent is 99 or less.
14 ?S:.
15 ?C:PRINTF_EXP_DIGITS:
16 ?C:     This symbol's value is either 2 or 3, corresponding to the
17 ?C:     number of exponent digits produced by the system's sprintf %[FGfg]
18 ?C:     formats when the modulus of the exponent is 99 or less.
19 ?C:.
20 ?H:#define PRINTF_EXP_DIGITS $d_printf_exp_digits
21 ?H:.
22 ?F:!try
23 : Check sprintf exponent digits
24 echo " "
25 echo "Checking how many exponent digits your sprintf formats use..."
26 $cat >try.c <<'EOSC'
27 #include <stdio.h>
28 int main() {
29   char b[10];
30   exit(sprintf(b, "%0.1e", 1.2) - 5);
31 }
32 EOSC
33 set try
34 if eval $compile; then
35         $run ./try
36         case "$?" in
37         2|3)    d_printf_exp_digits=$? ;;
38         esac
39 fi
40 case "$d_printf_exp_digits" in
41 2|3)    echo "Your sprintf seems to use $d_printf_exp_digits exponent digits."
42         ;;
43 *)      cat <<EOM >&4
44 I do not understand what your sprintf is saying.
45 I'm guessing it uses at least 2 exponent digits.
46 EOM
47         d_printf_exp_digits=2
48         ;;
49 esac
50 $rm -f try try.*
51