Commit | Line | Data |
---|---|---|
863963f1 JH |
1 | ?RCS: $Id$ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 2000 Jarkko Hietaniemi | |
4 | ?RCS: | |
5 | ?RCS: You may distribute under the terms of either the GNU General Public | |
6 | ?RCS: License or the Artistic License, as specified in the README file. | |
7 | ?RCS: | |
2cb64bf6 | 8 | ?MAKE:d_futimes: Compile cat rm_try run |
863963f1 JH |
9 | ?MAKE: -pick add $@ %< |
10 | ?S:d_futimes: | |
11 | ?S: This variable conditionally defines the HAS_FUTIMES symbol, which | |
12 | ?S: indicates to the C program that the futimes() routine is available. | |
13 | ?S:. | |
14 | ?C:HAS_FUTIMES: | |
15 | ?C: This symbol, if defined, indicates that the futimes routine is | |
16 | ?C: available to change file descriptor time stamps with struct timevals. | |
17 | ?C:. | |
18 | ?H:#$d_futimes HAS_FUTIMES /**/ | |
19 | ?H:. | |
55f714b6 | 20 | ?T:rc |
0065f4af | 21 | ?F:!try |
55f714b6 | 22 | : check for a working futimes |
d7a2632b | 23 | d_futimes="$undef" |
55f714b6 | 24 | echo " " |
2cb64bf6 | 25 | echo "Checking if you have a working futimes()" >&4 |
55f714b6 SP |
26 | $cat >try.c <<EOCP |
27 | #include <stdio.h> | |
28 | #include <sys/time.h> | |
29 | #include <errno.h> | |
30 | #include <fcntl.h> | |
31 | ||
32 | int main () | |
33 | { | |
34 | int fd, rv; | |
35 | fd = open ("try.c", O_RDWR); | |
36 | if (-1 == fd) exit (1); | |
37 | rv = futimes (fd, NULL); | |
38 | exit (rv == -1 ? errno : 0); | |
39 | } | |
40 | EOCP | |
41 | set try | |
42 | if eval $compile; then | |
43 | `$run ./try` | |
44 | rc=$? | |
45 | case "$rc" in | |
2cb64bf6 | 46 | 0) echo "Yes, you have" >&4 |
55f714b6 SP |
47 | d_futimes="$define" |
48 | ;; | |
2cb64bf6 | 49 | *) echo "No, you have futimes, but it isn't working ($rc) (probably harmless)" >&4 |
55f714b6 SP |
50 | ;; |
51 | esac | |
52 | else | |
914abcdc | 53 | echo "No, it does not (probably harmless)" >&4 |
55f714b6 | 54 | fi |
2cb64bf6 | 55 | $rm_try |
863963f1 | 56 |