1 | # Checks for stat-related time functions.
|
---|
2 |
|
---|
3 | # Copyright (C) 1998, 1999, 2001, 2003, 2005, 2006 Free Software
|
---|
4 | # Foundation, Inc.
|
---|
5 |
|
---|
6 | # This file is free software; the Free Software Foundation
|
---|
7 | # gives unlimited permission to copy and/or distribute it,
|
---|
8 | # with or without modifications, as long as this notice is preserved.
|
---|
9 |
|
---|
10 | dnl From Paul Eggert.
|
---|
11 |
|
---|
12 | # st_atim.tv_nsec - Linux, Solaris
|
---|
13 | # st_atimespec.tv_nsec - FreeBSD, if ! defined _POSIX_SOURCE
|
---|
14 | # st_atimensec - FreeBSD, if defined _POSIX_SOURCE
|
---|
15 | # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
|
---|
16 | # st_spare1 - Cygwin?
|
---|
17 |
|
---|
18 | AC_DEFUN([gl_STAT_TIME],
|
---|
19 | [
|
---|
20 | AC_REQUIRE([AC_C_INLINE])
|
---|
21 | AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
|
---|
22 |
|
---|
23 | AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
|
---|
24 | [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
|
---|
25 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
|
---|
26 | [AC_TRY_COMPILE(
|
---|
27 | [
|
---|
28 | #include <sys/types.h>
|
---|
29 | #if TIME_WITH_SYS_TIME
|
---|
30 | # include <sys/time.h>
|
---|
31 | # include <time.h>
|
---|
32 | #else
|
---|
33 | # if HAVE_SYS_TIME_H
|
---|
34 | # include <sys/time.h>
|
---|
35 | # else
|
---|
36 | # include <time.h>
|
---|
37 | # endif
|
---|
38 | #endif
|
---|
39 | #include <sys/stat.h>
|
---|
40 | struct timespec ts;
|
---|
41 | struct stat st;
|
---|
42 | ],
|
---|
43 | [
|
---|
44 | st.st_atim = ts;
|
---|
45 | ],
|
---|
46 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
|
---|
47 | [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
|
---|
48 | if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
|
---|
49 | AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], 1,
|
---|
50 | [Define to 1 if the type of the st_atim member of a struct stat is
|
---|
51 | struct timespec.])
|
---|
52 | fi],
|
---|
53 | [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
|
---|
54 | [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
|
---|
55 | [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [],
|
---|
56 | [AC_CHECK_MEMBERS([struct stat.st_spare1], [],
|
---|
57 | [],
|
---|
58 | [#include <sys/types.h>
|
---|
59 | #include <sys/stat.h>])],
|
---|
60 | [#include <sys/types.h>
|
---|
61 | #include <sys/stat.h>])],
|
---|
62 | [#include <sys/types.h>
|
---|
63 | #include <sys/stat.h>])],
|
---|
64 | [#include <sys/types.h>
|
---|
65 | #include <sys/stat.h>])],
|
---|
66 | [#include <sys/types.h>
|
---|
67 | #include <sys/stat.h>])
|
---|
68 | ])
|
---|