perl 5.0 alpha 9
[p5sagit/p5-mst-13.2.git] / U / d_casti32.U
CommitLineData
2304df62 1?RCS: $Id: d_casti32.U,v 3.0 1993/08/18 12:05:47 ram Exp $
2?RCS:
3?RCS: Copyright (c) 1991-1993, Raphael Manfredi
4?RCS:
5?RCS: You may redistribute only under the terms of the Artistic Licence,
6?RCS: as specified in the README file that comes with the distribution.
7?RCS: You may reuse parts of this distribution only within the terms of
8?RCS: that same Artistic Licence; a copy of which may be found at the root
9?RCS: of the source tree for dist 3.0.
10?RCS:
11?RCS: $Log: d_casti32.U,v $
12?RCS: Revision 3.0 1993/08/18 12:05:47 ram
13?RCS: Baseline for dist 3.0 netwide release.
14?RCS:
15?X:
16?X: Can the compiler cast large floats to 32-bit integers?
17?X:
85e6fe83 18?MAKE:d_casti32: cat cc ccflags rm intsize Setvar test
2304df62 19?MAKE: -pick add $@ %<
20?S:d_casti32:
21?S: This variable conditionally defines CASTI32, which indicates
22?S: wether the C compiler can cast large floats to 32-bit ints.
23?S:.
24?T:xxx yyy
25?C:CASTI32:
26?C: This symbol is defined if the C compiler can cast negative
27?C: or large floating point numbers to 32-bit ints.
28?C:.
29?H:#$d_casti32 CASTI32 /**/
30?H:.
31?LINT:set d_casti32
32: check for ability to cast large floats to 32-bit ints.
33echo " "
34echo 'Checking whether your C compiler can cast large floats to int32.' >&4
85e6fe83 35if $test "$intsize" -eq 4; then
2304df62 36 xxx=int
37else
38 xxx=long
39fi
40
41$cat >try.c <<EOCP
42#include <sys/types.h>
43#include <signal.h>
44blech() { exit(3); }
45main()
46{
47 $xxx i32;
48 double f;
49 int result = 0;
50 signal(SIGFPE, blech);
51
52 f = (double) 0x7fffffff;
53 f = 10 * f;
54 i32 = ( $xxx )f;
55
56 if (i32 != ( $xxx )f)
57 result |= 1;
58 exit(result);
59}
60EOCP
61if $cc -o try $ccflags try.c >/dev/null 2>&1; then
62 ./try
63 yyy=$?
64else
65 yyy=1
66fi
67case "$yyy" in
680) val="$define"
69 echo "Yup, it can."
70 ;;
71*) val="$undef"
72 echo "Nope, it can't."
73 ;;
74esac
75set d_casti32
76eval $setvar
85e6fe83 77$rm -f try try.*