This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Part 1 of a big cleanup action based on the upcoming dist-4.0
[metaconfig.git] / U / typedefs / sizesize.U
CommitLineData
d048fb47
JH
1?RCS:
2?RCS: Copyright (c) 1999, Jarkko Hietaniemi
3?RCS:
4?RCS: You may redistribute only under the terms of the Artistic Licence,
5?RCS: as specified in the README file that comes with the distribution.
6?RCS: You may reuse parts of this distribution only within the terms of
7?RCS: that same Artistic Licence; a copy of which may be found at the root
8?RCS: of the source tree for dist 3.0.
9?RCS:
3b148aa9 10?MAKE:sizesize: Myread Typedef sizetype Compile run i_stdlib
d048fb47
JH
11?MAKE: -pick add $@ %<
12?S:sizesize:
13?S: This variable contains the size of a sizetype in bytes.
14?S:.
15?C:Size_t_size:
16?C: This symbol holds the size of a Size_t in bytes.
17?C:.
18?H:#define Size_t_size $sizesize /* */
19?H:.
d048fb47
JH
20?T:yyy zzz
21?LINT: set sizesize
22echo " "
23case "$sizetype" in
24*_t) zzz="$sizetype" ;;
25*) zzz="filesize" ;;
26esac
27echo "Checking the size of $zzz..." >&4
28cat > try.c <<EOCP
29#include <sys/types.h>
30#include <stdio.h>
3b148aa9
JH
31#$i_stdlib I_STDLIB
32#ifdef I_STDLIB
33#include <stdlib.h>
34#endif
d048fb47
JH
35int main() {
36 printf("%d\n", (int)sizeof($sizetype));
37 exit(0);
38}
39EOCP
40set try
41if eval $compile_ok; then
0f00356b 42 yyy=`$run ./try`
d048fb47
JH
43 case "$yyy" in
44 '') sizesize=4
45 echo "(I can't execute the test program--guessing $sizesize.)" >&4
46 ;;
47 *) sizesize=$yyy
48 echo "Your $zzz size is $sizesize bytes."
49 ;;
50 esac
51else
52 sizesize=4
53 echo "(I can't compile the test program--guessing $sizesize.)" >&4
54fi
55
56