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