Mercurial > hg > octave-jordi > gnulib-hg
annotate m4/stat-time.m4 @ 8568:392970b32717
Support sub-second birthtime on cygwin.
* m4/stat-time.m4 (gl_STAT_BIRTHTIME): Also check for st_birthtim.
* lib/stat-time.h (STAT_TIMESPEC): Adjust comments.
(get_stat_birthtime): Also work with st_birthtim.
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Tue, 27 Mar 2007 20:03:47 +0000 |
parents | f7fc3652bfc5 |
children | f6cba5a556ce |
rev | line source |
---|---|
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
1 # Checks for stat-related time functions. |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
2 |
7897
b7a83a69ac23
* MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
3 # Copyright (C) 1998, 1999, 2001, 2003, 2005, 2006, 2007 Free Software |
7172
be9e01d008cb
Avoid the need for AC_LIBSOURCES in m4 macros.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6471
diff
changeset
|
4 # Foundation, Inc. |
be9e01d008cb
Avoid the need for AC_LIBSOURCES in m4 macros.
Paul Eggert <eggert@cs.ucla.edu>
parents:
6471
diff
changeset
|
5 |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
6 # This file is free software; the Free Software Foundation |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
7 # gives unlimited permission to copy and/or distribute it, |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
8 # with or without modifications, as long as this notice is preserved. |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
9 |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
10 dnl From Paul Eggert. |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
11 |
8568
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
12 # st_atim.tv_nsec - Linux, Solaris, Cygwin |
8565
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
13 # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
14 # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
15 # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1) |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
16 |
8567
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
17 # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway) |
8568
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
18 # st_birthtim - Cygwin 1.7.0+ |
8565
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
19 |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
20 AC_DEFUN([gl_STAT_TIME], |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
21 [ |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
22 AC_REQUIRE([AC_C_INLINE]) |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
23 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
7897
b7a83a69ac23
* MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
24 AC_CHECK_HEADERS_ONCE([sys/time.h]) |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
25 |
6471
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
26 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
27 [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
28 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
29 [AC_TRY_COMPILE( |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
30 [ |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
31 #include <sys/types.h> |
7897
b7a83a69ac23
* MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
32 #include <sys/stat.h> |
b7a83a69ac23
* MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
33 #if HAVE_SYS_TIME_H |
6471
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
34 # include <sys/time.h> |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
35 #endif |
7897
b7a83a69ac23
* MODULES.html.sh (Support for systems lacking POSIX:2001): New
Paul Eggert <eggert@cs.ucla.edu>
parents:
7172
diff
changeset
|
36 #include <time.h> |
6471
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
37 struct timespec ts; |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
38 struct stat st; |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
39 ], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
40 [ |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
41 st.st_atim = ts; |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
42 ], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
43 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes], |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
44 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])]) |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
45 if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
46 AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], 1, |
8568
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
47 [Define to 1 if the type of the st_atim member of a struct stat is |
6471
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
48 struct timespec.]) |
54a70822331f
* m4/stat-time.m4 (STATE_TIMESPEC, STAT_TIMESPEC_NS): Add check for
Paul Eggert <eggert@cs.ucla.edu>
parents:
6237
diff
changeset
|
49 fi], |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
50 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [], |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
51 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [], |
8567
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
52 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [], |
6237
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
53 [#include <sys/types.h> |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
54 #include <sys/stat.h>])], |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
55 [#include <sys/types.h> |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
56 #include <sys/stat.h>])], |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
57 [#include <sys/types.h> |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
58 #include <sys/stat.h>])], |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
59 [#include <sys/types.h> |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
60 #include <sys/stat.h>]) |
d81a8251a9b0
* MODULES.html.sh (File system functions): Add stat-time.
Paul Eggert <eggert@cs.ucla.edu>
parents:
diff
changeset
|
61 ]) |
8565
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
62 |
8568
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
63 # Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.) |
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
64 # and NTFS (Cygwin). |
8567
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
65 # There was a time when this field was named st_createtime (21 June |
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
66 # 2002 to 16 July 2002) But that window is very small and applied only |
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
67 # to development code, so systems still using that configuration are |
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
68 # not supported. See revisions 1.10 and 1.11 of FreeBSD's |
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
69 # src/sys/ufs/ufs/dinode.h. |
8565
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
70 # |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
71 AC_DEFUN([gl_STAT_BIRTHTIME], |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
72 [ |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
73 AC_REQUIRE([AC_C_INLINE]) |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
74 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS]) |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
75 AC_CHECK_HEADERS_ONCE([sys/time.h]) |
8567
f7fc3652bfc5
* lib/stat-time.h (USE_BIRTHTIME): Remove.
Paul Eggert <eggert@cs.ucla.edu>
parents:
8565
diff
changeset
|
76 AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [], |
8568
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
77 [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [], |
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
78 [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [], |
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
79 [#include <sys/types.h> |
392970b32717
Support sub-second birthtime on cygwin.
Eric Blake <ebb9@byu.net>
parents:
8567
diff
changeset
|
80 #include <sys/stat.h>])], |
8565
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
81 [#include <sys/types.h> |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
82 #include <sys/stat.h>])], |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
83 [#include <sys/types.h> |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
84 #include <sys/stat.h>]) |
c49cf515502f
2007-03-27 Bruno Haible <bruno@clisp.org>
Bruno Haible <bruno@clisp.org>
parents:
7897
diff
changeset
|
85 ]) |