Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: d_brokstat.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
cf39bd7e | 4 | ?RCS: |
d8875586 MBT |
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 4.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: d_brokstat.U,v $ | |
12 | ?RCS: Revision 3.0.1.1 1997/02/28 15:30:53 ram | |
13 | ?RCS: patch61: created | |
14 | ?RCS: | |
15 | ?MAKE:d_brokstat: cat contains cppstdin cppminus +cppflags rm Setvar | |
16 | ?MAKE: -pick add $@ %< | |
17 | ?S:d_brokstat: | |
18 | ?S: This variable conditionally defines STAT_MACROS_BROKEN if some | |
19 | ?S: of the S_IS*() macros from <sys/stat.h> give false positive on | |
20 | ?S: regular files. | |
21 | ?S:. | |
22 | ?C:STAT_MACROS_BROKEN: | |
23 | ?C: This symbol, if defined, indicates that the S_IS*() stat macros | |
24 | ?C: such as S_ISBLK() give false positive and are thus unusable. | |
25 | ?C: Your best bet is then to supply your own set. | |
26 | ?C:. | |
27 | ?H:#$d_brokstat STAT_MACROS_BROKEN /**/ | |
28 | ?H:. | |
29 | ?F:!try.c !try | |
30 | ?LINT:set d_brokstat | |
31 | ?LINT:usefile try | |
32 | ?X: This test inspired by autoconf -- RAM, 28/02/97 | |
33 | : are stat macros sane? | |
34 | echo " " | |
35 | echo "Checking whether your stat() macros are broken..." | |
36 | $cat >try.c <<'EOC' | |
37 | #include <sys/types.h> | |
38 | #include <sys/stat.h> | |
39 | ||
40 | #if defined(S_ISBLK) && defined(S_IFDIR) | |
41 | #if S_ISBLK(S_IFDIR) | |
42 | Broken | |
43 | #endif | |
44 | #endif | |
45 | ||
46 | #if defined(S_ISBLK) && defined(S_IFCHR) | |
47 | #if S_ISBLK(S_IFCHR) | |
48 | Broken | |
49 | #endif | |
50 | #endif | |
51 | ||
52 | #if defined(S_ISLNK) && defined(S_IFREG) | |
53 | #if S_ISLNK(S_IFREG) | |
54 | Broken. | |
55 | #endif | |
56 | #endif | |
57 | ||
58 | #if defined(S_ISSOCK) && defined(S_IFREG) | |
59 | #if S_ISSOCK(S_IFREG) | |
60 | Broken. | |
61 | #endif | |
62 | #endif | |
63 | EOC | |
64 | $cppstdin $cppflags $cppminus <try.c 2>/dev/null >try | |
65 | if $contains Broken try >/dev/null 2>&1; then | |
66 | echo "Alas, they are. I'll use my own macro set then." >&4 | |
67 | val="$define" | |
68 | else | |
69 | echo "Nope, working just fine." >&4 | |
70 | val="$undef" | |
71 | fi | |
72 | $rm -f try try.c | |
73 | set d_brokstat | |
74 | eval $setvar | |
75 |