1 # sys_stat_h.m4 serial 26 -*- Autoconf -*-
2 dnl Copyright (C) 2006-2011 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 For the mkdir substitute.
15 AC_REQUIRE([AC_C_INLINE])
17 dnl Check for broken stat macros.
18 AC_REQUIRE([AC_HEADER_STAT])
20 gl_CHECK_NEXT_HEADERS([sys/stat.h])
22 dnl Ensure the type mode_t gets defined.
23 AC_REQUIRE([AC_TYPE_MODE_T])
25 dnl Define types that are supposed to be defined in <sys/types.h> or
27 AC_CHECK_TYPE([nlink_t], [],
28 [AC_DEFINE([nlink_t], [int],
29 [Define to the type of st_nlink in struct stat, or a supertype.])],
30 [#include <sys/types.h>
31 #include <sys/stat.h>])
33 dnl Check for declarations of anything we want to poison if the
34 dnl corresponding gnulib module is not in use.
35 gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
36 ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
37 mknod mknodat stat utimensat])
38 ]) # gl_HEADER_SYS_STAT_H
40 AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
42 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
43 AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
44 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
45 dnl Define it also as a C macro, for the benefit of the unit tests.
46 gl_MODULE_INDICATOR_FOR_TESTS([$1])
49 AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
51 AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR
52 GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT])
53 GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT])
54 GNULIB_FSTATAT=0; AC_SUBST([GNULIB_FSTATAT])
55 GNULIB_FUTIMENS=0; AC_SUBST([GNULIB_FUTIMENS])
56 GNULIB_LCHMOD=0; AC_SUBST([GNULIB_LCHMOD])
57 GNULIB_LSTAT=0; AC_SUBST([GNULIB_LSTAT])
58 GNULIB_MKDIRAT=0; AC_SUBST([GNULIB_MKDIRAT])
59 GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO])
60 GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT])
61 GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD])
62 GNULIB_MKNODAT=0; AC_SUBST([GNULIB_MKNODAT])
63 GNULIB_STAT=0; AC_SUBST([GNULIB_STAT])
64 GNULIB_UTIMENSAT=0; AC_SUBST([GNULIB_UTIMENSAT])
65 dnl Assume proper GNU behavior unless another module says otherwise.
66 HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
67 HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
68 HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS])
69 HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
70 HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
71 HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
72 HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO])
73 HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
74 HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD])
75 HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])
76 HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT])
77 REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT])
78 REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT])
79 REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS])
80 REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT])
81 REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR])
82 REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO])
83 REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD])
84 REPLACE_STAT=0; AC_SUBST([REPLACE_STAT])
85 REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT])