Blame m4/stat-time.m4

Packit Service 4684c1
# Checks for stat-related time functions.
Packit Service 4684c1
Packit Service 4684c1
# Copyright (C) 1998-1999, 2001, 2003, 2005-2007, 2009-2020 Free Software
Packit Service 4684c1
# Foundation, Inc.
Packit Service 4684c1
Packit Service 4684c1
# This file is free software; the Free Software Foundation
Packit Service 4684c1
# gives unlimited permission to copy and/or distribute it,
Packit Service 4684c1
# with or without modifications, as long as this notice is preserved.
Packit Service 4684c1
Packit Service 4684c1
dnl From Paul Eggert.
Packit Service 4684c1
Packit Service 4684c1
# st_atim.tv_nsec - Linux, Solaris, Cygwin
Packit Service 4684c1
# st_atimespec.tv_nsec - FreeBSD, NetBSD, if ! defined _POSIX_SOURCE
Packit Service 4684c1
# st_atimensec - FreeBSD, NetBSD, if defined _POSIX_SOURCE
Packit Service 4684c1
# st_atim.st__tim.tv_nsec - UnixWare (at least 2.1.2 through 7.1)
Packit Service 4684c1
Packit Service 4684c1
# st_birthtimespec - FreeBSD, NetBSD (hidden on OpenBSD 3.9, anyway)
Packit Service 4684c1
# st_birthtim - Cygwin 1.7.0+
Packit Service 4684c1
Packit Service 4684c1
AC_DEFUN([gl_STAT_TIME],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
Packit Service 4684c1
  AC_CHECK_HEADERS_ONCE([sys/time.h])
Packit Service 4684c1
Packit Service 4684c1
  AC_CHECK_MEMBERS([struct stat.st_atim.tv_nsec],
Packit Service 4684c1
    [AC_CACHE_CHECK([whether struct stat.st_atim is of type struct timespec],
Packit Service 4684c1
       [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec],
Packit Service 4684c1
       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
Packit Service 4684c1
          [[
Packit Service 4684c1
            #include <sys/types.h>
Packit Service 4684c1
            #include <sys/stat.h>
Packit Service 4684c1
            #if HAVE_SYS_TIME_H
Packit Service 4684c1
            # include <sys/time.h>
Packit Service 4684c1
            #endif
Packit Service 4684c1
            #include <time.h>
Packit Service 4684c1
            struct timespec ts;
Packit Service 4684c1
            struct stat st;
Packit Service 4684c1
          ]],
Packit Service 4684c1
          [[
Packit Service 4684c1
            st.st_atim = ts;
Packit Service 4684c1
          ]])],
Packit Service 4684c1
          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=yes],
Packit Service 4684c1
          [ac_cv_typeof_struct_stat_st_atim_is_struct_timespec=no])])
Packit Service 4684c1
     if test $ac_cv_typeof_struct_stat_st_atim_is_struct_timespec = yes; then
Packit Service 4684c1
       AC_DEFINE([TYPEOF_STRUCT_STAT_ST_ATIM_IS_STRUCT_TIMESPEC], [1],
Packit Service 4684c1
         [Define to 1 if the type of the st_atim member of a struct stat is
Packit Service 4684c1
          struct timespec.])
Packit Service 4684c1
     fi],
Packit Service 4684c1
    [AC_CHECK_MEMBERS([struct stat.st_atimespec.tv_nsec], [],
Packit Service 4684c1
       [AC_CHECK_MEMBERS([struct stat.st_atimensec], [],
Packit Service 4684c1
          [AC_CHECK_MEMBERS([struct stat.st_atim.st__tim.tv_nsec], [], [],
Packit Service 4684c1
             [#include <sys/types.h>
Packit Service 4684c1
              #include <sys/stat.h>])],
Packit Service 4684c1
          [#include <sys/types.h>
Packit Service 4684c1
           #include <sys/stat.h>])],
Packit Service 4684c1
       [#include <sys/types.h>
Packit Service 4684c1
        #include <sys/stat.h>])],
Packit Service 4684c1
    [#include <sys/types.h>
Packit Service 4684c1
     #include <sys/stat.h>])
Packit Service 4684c1
])
Packit Service 4684c1
Packit Service 4684c1
# Check for st_birthtime, a feature from UFS2 (FreeBSD, NetBSD, OpenBSD, etc.)
Packit Service 4684c1
# and NTFS (Cygwin).
Packit Service 4684c1
# There was a time when this field was named st_createtime (21 June
Packit Service 4684c1
# 2002 to 16 July 2002) But that window is very small and applied only
Packit Service 4684c1
# to development code, so systems still using that configuration are
Packit Service 4684c1
# not supported.  See revisions 1.10 and 1.11 of FreeBSD's
Packit Service 4684c1
# src/sys/ufs/ufs/dinode.h.
Packit Service 4684c1
#
Packit Service 4684c1
AC_DEFUN([gl_STAT_BIRTHTIME],
Packit Service 4684c1
[
Packit Service 4684c1
  AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
Packit Service 4684c1
  AC_CHECK_HEADERS_ONCE([sys/time.h])
Packit Service 4684c1
  AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec], [],
Packit Service 4684c1
    [AC_CHECK_MEMBERS([struct stat.st_birthtimensec], [],
Packit Service 4684c1
      [AC_CHECK_MEMBERS([struct stat.st_birthtim.tv_nsec], [], [],
Packit Service 4684c1
         [#include <sys/types.h>
Packit Service 4684c1
          #include <sys/stat.h>])],
Packit Service 4684c1
       [#include <sys/types.h>
Packit Service 4684c1
        #include <sys/stat.h>])],
Packit Service 4684c1
    [#include <sys/types.h>
Packit Service 4684c1
     #include <sys/stat.h>])
Packit Service 4684c1
])