1 # sys_stat_h.m4 serial 31 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2017 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 lchmod lstat mkdirat mkfifo mkfifoat
50 mknod mknodat stat utimensat])
51 ]) # gl_HEADER_SYS_STAT_H
53 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
55 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
56 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
57 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
58 dnl Define it also as a C macro, for the benefit of the unit tests.
59 gl_MODULE_INDICATOR_FOR_TESTS([$1])
62 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
64 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
65 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
66 GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
67 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
68 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
69 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
70 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
71 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
72 GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
73 GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
74 GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
75 GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
76 GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
77 GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
78 GNULIB_OVERRIDES_STRUCT_STAT=0; AC_SUBST([GNULIB_OVERRIDES_STRUCT_STAT])
79 dnl Assume proper GNU behavior unless another module says otherwise.
80 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
81 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
82 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
83 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
84 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
85 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
86 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
87 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
88 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
89 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
90 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
91 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
92 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
93 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
94 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
95 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
96 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
97 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
98 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
99 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])