This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Tidy up the metaconfig test programs.
[metaconfig.git] / U / typedefs / pidsize.U
CommitLineData
5d52f3dc
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:
65b9a706 10?MAKE:pidsize: Myread Typedef pidtype Compile
5d52f3dc
JH
11?MAKE: -pick add $@ %<
12?S:pidsize:
13?S: This variable contains the size of a pidtype in bytes.
14?S:.
15?C:Pid_t_SIZE:
16?C: This symbol holds the size of a Pid_t in bytes.
17?C:.
18?H:#define Pid_t_SIZE $pidsize /* PID size */
19?H:.
20?F:!try
67d5479e 21?T:yyy zzz
5d52f3dc
JH
22?LINT: set pidsize
23echo " "
67d5479e
JH
24case "$pidtype" in
25*_t) zzz="$pidtype" ;;
26*) zzz="pid" ;;
27esac
28echo "Checking the size of $zzz..." >&4
29cat > try.c <<EOCP
5d52f3dc
JH
30#include <sys/types.h>
31#include <stdio.h>
32int main() {
37a56d0d
JH
33 printf("%d\n", (int)sizeof($pidtype));
34 return(0);
5d52f3dc
JH
35}
36EOCP
384e0155 37set try
65b9a706 38if eval $compile_ok; then
5d52f3dc
JH
39 yyy=`./try`
40 case "$yyy" in
41 '') pidsize=4
42 echo "(I can't execute the test program--guessing $pidsize.)" >&4
43 ;;
44 *) pidsize=$yyy
67d5479e 45 echo "Your $zzz size is $pidsize bytes."
5d52f3dc
JH
46 ;;
47 esac
48else
49 pidsize=4
50 echo "(I can't compile the test program--guessing $pidsize.)" >&4
51fi
52