1 # sys_stat_h.m4 serial 34 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2020 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
8 dnl Provide a GNU-like <sys/stat.h>.
10 AC_DEFUN([gl_HEADER_SYS_STAT_H],
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
14 dnl Check for broken stat macros.
15 AC_REQUIRE([AC_HEADER_STAT])
17 gl_CHECK_NEXT_HEADERS([sys/stat.h])
19 dnl Ensure the type mode_t gets defined.
20 AC_REQUIRE([AC_TYPE_MODE_T])
22 dnl Whether to enable precise timestamps in 'struct stat'.
23 m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [
24 AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC])
26 WINDOWS_STAT_TIMESPEC=0
28 AC_SUBST([WINDOWS_STAT_TIMESPEC])
30 dnl Whether to ensure that struct stat.st_size is 64-bit wide.
31 m4_ifdef([gl_LARGEFILE], [
32 AC_REQUIRE([gl_LARGEFILE])
34 WINDOWS_64_BIT_ST_SIZE=0
36 AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
38 dnl Define types that are supposed to be defined in <sys/types.h> or
40 AC_CHECK_TYPE([nlink_t], [],
41 [AC_DEFINE([nlink_t], [int],
42 [Define to the type of st_nlink in struct stat, or a supertype.])],
43 [#include <sys/types.h>
44 #include <sys/stat.h>])
46 dnl Check for declarations of anything we want to poison if the
47 dnl corresponding gnulib module is not in use.
48 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
49 ]], [fchmodat fstat fstatat futimens getumask lchmod lstat
50 mkdirat mkfifo mkfifoat mknod mknodat stat utimensat])
52 AC_REQUIRE([AC_C_RESTRICT])
55 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
57 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
58 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
59 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
60 dnl Define it also as a C macro, for the benefit of the unit tests.
61 gl_MODULE_INDICATOR_FOR_TESTS([$1])
64 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
66 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
67 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
68 GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
69 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
70 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
71 GNULIB_GETUMASK=0; AC_SUBST([GNULIB_GETUMASK])
72 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
73 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
74 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
75 GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
76 GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
77 GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
78 GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
79 GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
80 GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
81 GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT])
82 dnl Assume proper GNU behavior unless another module says otherwise.
83 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
84 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
85 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
86 HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK])
87 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
88 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
89 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
90 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
91 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
92 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
93 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
94 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
95 REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT])
96 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
97 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
98 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
99 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
100 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
101 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
102 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
103 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
104 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])