1 # Checks for stat-related time functions.
3 # Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2012 Free Software
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.
11 dnl Modified by Chet Ramey for bush.
13 # st_atim.tv_nsec - Linux, Solaris, Cygwin
14 # st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
15 # st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
16 # st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
18 # st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
19 # st_birthtim - Cygwin 1.7.0+
21 AC_DEFUN([BUSH_STAT_TIME],
23 AC_REQUIRE([AC_C_INLINE])
24 AC_CHECK_HEADERS_ONCE([sys/time.h])
26 AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
27 [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
28 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
29 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
31 #include <sys/types.h>
34 # include <sys/time.h>
43 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
44 [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
45 if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
46 AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
47 [Define to 1 if the type of the st_atim member of a struct stat is
50 [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
51 [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
52 [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
53 [#include <sys/types.h>
54 #include <sys/stat.h>])],
55 [#include <sys/types.h>
56 #include <sys/stat.h>])],
57 [#include <sys/types.h>
58 #include <sys/stat.h>])],
59 [#include <sys/types.h>
60 #include <sys/stat.h>])