1 # sys_stat_h.m4 serial 28 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2016 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 override 'struct stat'.
23 m4_ifdef([gl_LARGEFILE], [
24 AC_REQUIRE([gl_LARGEFILE])
26 WINDOWS_64_BIT_ST_SIZE=0
28 AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
29 if test $WINDOWS_64_BIT_ST_SIZE = 1; then
30 AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
31 [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
32 struct stat.st_size becomes 64-bit.])
35 dnl Define types that are supposed to be defined in <sys/types.h> or
37 AC_CHECK_TYPE([nlink_t], [],
38 [AC_DEFINE([nlink_t], [int],
39 [Define to the type of st_nlink in struct stat, or a supertype.])],
40 [#include <sys/types.h>
41 #include <sys/stat.h>])
43 dnl Check for declarations of anything we want to poison if the
44 dnl corresponding gnulib module is not in use.
45 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
46 ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
47 mknod mknodat stat utimensat])
48 ]) # gl_HEADER_SYS_STAT_H
50 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
52 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
53 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
54 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
55 dnl Define it also as a C macro, for the benefit of the unit tests.
56 gl_MODULE_INDICATOR_FOR_TESTS([$1])
59 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
61 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
62 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
63 GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
64 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
65 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
66 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
67 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
68 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
69 GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
70 GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
71 GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
72 GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
73 GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
74 GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
75 dnl Assume proper GNU behavior unless another module says otherwise.
76 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
77 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
78 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
79 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
80 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
81 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
82 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
83 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
84 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
85 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
86 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
87 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
88 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
89 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
90 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
91 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
92 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
93 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
94 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
95 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])