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 / st_ino_def.U
CommitLineData
f7ded2b4
MB
1?RCS: Copyright (c) 2011, H.Merijn Brand & Tony Cook
2?RCS:
65a32477 3?RCS: You may redistribute only under the terms of the Artistic License,
f7ded2b4
MB
4?RCS: as specified in the README file that comes with the distribution.
5?RCS: You may reuse parts of this distribution only within the terms of
65a32477 6?RCS: that same Artistic License; a copy of which may be found at the root
f7ded2b4
MB
7?RCS: of the source tree for dist 3.0.
8?RCS:
9?MAKE:st_ino_size st_ino_sign: cat echo i_stdlib Setvar Compile run rm_try
10?MAKE: -pick add $@ %<
11?S:st_ino_sign:
12?S: This variable contains the signedness of struct stat's st_ino.
13?S: 1 for unsigned, -1 for signed.
14?S:.
15?S:st_ino_size:
16?S: This variable contains the size of struct stat's st_ino in bytes.
17?S:.
18?C:ST_INO_SIZE:
19?C: This variable contains the size of struct stat's st_ino in bytes.
20?C:.
21?C:ST_INO_SIGN:
3cfe0f67 22?C: This symbol holds the signedness of struct stat's st_ino.
f7ded2b4
MB
23?C: 1 for unsigned, -1 for signed.
24?C:.
25?H:#define ST_INO_SIGN $st_ino_sign /* st_ino sign */
26?H:#define ST_INO_SIZE $st_ino_size /* st_ino size */
27?H:.
28?F:!try
29: Check the size of st_ino
30$echo " "
31$echo "Checking the size of st_ino..." >&4
32$cat > try.c <<EOCP
33#include <sys/stat.h>
34#include <stdio.h>
35#$i_stdlib I_STDLIB
36#ifdef I_STDLIB
37#include <stdlib.h>
38#endif
39int main() {
40 struct stat st;
41 printf("%d\n", (int)sizeof(st.st_ino));
42 exit(0);
43}
44EOCP
45set try
46if eval $compile_ok; then
47 val=`$run ./try`
48 case "$val" in
49 '') st_ino_size=4
50 $echo "(I can't execute the test program--guessing $st_ino_size.)" >&4
51 ;;
52 *) st_ino_size=$val
53 $echo "Your st_ino is $st_ino_size bytes long."
54 ;;
55 esac
56else
57 st_ino_size=4
58 $echo "(I can't compile the test program--guessing $st_ino_size.)" >&4
59fi
60$rm_try
61
62: Check if st_ino is signed
63$echo " "
64$echo "Checking the sign of st_ino..." >&4
65$cat > try.c <<EOCP
66#include <sys/stat.h>
67#include <stdio.h>
68int main() {
69 struct stat foo;
70 foo.st_ino = -1;
71 if (foo.st_ino < 0)
72 printf("-1\n");
73 else
74 printf("1\n");
75}
76EOCP
77set try
78if eval $compile; then
79 val=`$run ./try`
80 case "$val" in
81 '') st_ino_sign=1
82 $echo "(I can't execute the test program--guessing unsigned.)" >&4
83 ;;
84 *) st_ino_sign=$val
85 case "$st_ino_sign" in
86 1) $echo "Your st_ino is unsigned." ;;
87 -1) $echo "Your st_ino is signed." ;;
88 esac
89 ;;
90 esac
91else
92 st_ino_sign=1
93 $echo "(I can't compile the test program--guessing unsigned.)" >&4
94fi
95$rm_try
96