summaryrefslogtreecommitdiffstats
path: root/gl/m4/sys_stat_h.m4
diff options
context:
space:
mode:
authorRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2021-11-17 01:05:54 +0100
committerRincewindsHat <12514511+RincewindsHat@users.noreply.github.com>2022-07-24 19:35:11 +0200
commita405fc138596f552581d2011fd6de02d5c8186c4 (patch)
tree4c084700b5cb5e9fcedf982a2d921bbc41d9935a /gl/m4/sys_stat_h.m4
parent9f2a9ca3d72023ff9b5707d1872c54d65edc9017 (diff)
downloadmonitoring-plugins-a405fc138596f552581d2011fd6de02d5c8186c4.tar.gz
Sync with the latest Gnulib code (1a268176f)
Diffstat (limited to 'gl/m4/sys_stat_h.m4')
-rw-r--r--gl/m4/sys_stat_h.m4127
1 files changed, 127 insertions, 0 deletions
diff --git a/gl/m4/sys_stat_h.m4 b/gl/m4/sys_stat_h.m4
new file mode 100644
index 00000000..ac91d425
--- /dev/null
+++ b/gl/m4/sys_stat_h.m4
@@ -0,0 +1,127 @@
1# sys_stat_h.m4 serial 41 -*- Autoconf -*-
2dnl Copyright (C) 2006-2021 Free Software Foundation, Inc.
3dnl This file is free software; the Free Software Foundation
4dnl gives unlimited permission to copy and/or distribute it,
5dnl with or without modifications, as long as this notice is preserved.
6
7dnl From Eric Blake.
8dnl Provide a GNU-like <sys/stat.h>.
9
10AC_DEFUN_ONCE([gl_SYS_STAT_H],
11[
12 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
13
14 dnl Check for broken stat macros.
15 AC_REQUIRE([AC_HEADER_STAT])
16
17 gl_CHECK_NEXT_HEADERS([sys/stat.h])
18
19 dnl Ensure the type mode_t gets defined.
20 AC_REQUIRE([AC_TYPE_MODE_T])
21
22 dnl Whether to enable precise timestamps in 'struct stat'.
23 m4_ifdef([gl_WINDOWS_STAT_TIMESPEC], [
24 AC_REQUIRE([gl_WINDOWS_STAT_TIMESPEC])
25 ], [
26 WINDOWS_STAT_TIMESPEC=0
27 ])
28 AC_SUBST([WINDOWS_STAT_TIMESPEC])
29
30 dnl Whether to ensure that struct stat.st_size is 64-bit wide.
31 m4_ifdef([gl_LARGEFILE], [
32 AC_REQUIRE([gl_LARGEFILE])
33 ], [
34 WINDOWS_64_BIT_ST_SIZE=0
35 ])
36 AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
37
38 dnl Define types that are supposed to be defined in <sys/types.h> or
39 dnl <sys/stat.h>.
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>])
45
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])
51
52 AC_REQUIRE([AC_C_RESTRICT])
53])
54
55# gl_SYS_STAT_MODULE_INDICATOR([modulename])
56# sets the shell variable that indicates the presence of the given module
57# to a C preprocessor expression that will evaluate to 1.
58# This macro invocation must not occur in macros that are AC_REQUIREd.
59AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
60[
61 dnl Ensure to expand the default settings once only.
62 gl_SYS_STAT_H_REQUIRE_DEFAULTS
63 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
64 dnl Define it also as a C macro, for the benefit of the unit tests.
65 gl_MODULE_INDICATOR_FOR_TESTS([$1])
66])
67
68# Initializes the default values for AC_SUBSTed shell variables.
69# This macro must not be AC_REQUIREd. It must only be invoked, and only
70# outside of macros or in macros that are not AC_REQUIREd.
71AC_DEFUN([gl_SYS_STAT_H_REQUIRE_DEFAULTS],
72[
73 m4_defun(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS], [
74 gl_UNISTD_H_REQUIRE_DEFAULTS dnl for REPLACE_FCHDIR
75 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FCHMODAT])
76 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTAT])
77 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FSTATAT])
78 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_FUTIMENS])
79 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_GETUMASK])
80 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LCHMOD])
81 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_LSTAT])
82 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIR])
83 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKDIRAT])
84 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFO])
85 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKFIFOAT])
86 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNOD])
87 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MKNODAT])
88 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STAT])
89 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_UTIMENSAT])
90 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_OVERRIDES_STRUCT_STAT])
91 dnl Support Microsoft deprecated alias function names by default.
92 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_CHMOD], [1])
93 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_MKDIR], [1])
94 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MDA_UMASK], [1])
95 ])
96 m4_require(GL_MODULE_INDICATOR_PREFIX[_SYS_STAT_H_MODULE_INDICATOR_DEFAULTS])
97 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
98])
99
100AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
101[
102 dnl Assume proper GNU behavior unless another module says otherwise.
103 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
104 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
105 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
106 HAVE_GETUMASK=1; AC_SUBST([HAVE_GETUMASK])
107 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
108 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
109 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
110 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
111 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
112 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
113 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
114 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
115 REPLACE_FCHMODAT=0; AC_SUBST([REPLACE_FCHMODAT])
116 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
117 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
118 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
119 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
120 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
121 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
122 REPLACE_MKFIFOAT=0; AC_SUBST([REPLACE_MKFIFOAT])
123 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
124 REPLACE_MKNODAT=0; AC_SUBST([REPLACE_MKNODAT])
125 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
126 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])
127])