Commit | Line | Data |
---|---|---|
005de2e8 | 1 | # sys_stat_h.m4 serial 27 -*- Autoconf -*- |
f0007cad | 2 | dnl Copyright (C) 2006-2012 Free Software Foundation, Inc. |
8912421c LC |
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. | |
6 | ||
7 | dnl From Eric Blake. | |
8 | dnl Provide a GNU-like <sys/stat.h>. | |
9 | ||
10 | AC_DEFUN([gl_HEADER_SYS_STAT_H], | |
11 | [ | |
12 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | |
13 | ||
14 | dnl For the mkdir substitute. | |
15 | AC_REQUIRE([AC_C_INLINE]) | |
16 | ||
17 | dnl Check for broken stat macros. | |
18 | AC_REQUIRE([AC_HEADER_STAT]) | |
19 | ||
20 | gl_CHECK_NEXT_HEADERS([sys/stat.h]) | |
21 | ||
35428fb6 LC |
22 | dnl Ensure the type mode_t gets defined. |
23 | AC_REQUIRE([AC_TYPE_MODE_T]) | |
24 | ||
005de2e8 LC |
25 | dnl Whether to override 'struct stat'. |
26 | m4_ifdef([gl_LARGEFILE], [ | |
27 | AC_REQUIRE([gl_LARGEFILE]) | |
28 | ], [ | |
29 | WINDOWS_64_BIT_ST_SIZE=0 | |
30 | ]) | |
31 | AC_SUBST([WINDOWS_64_BIT_ST_SIZE]) | |
32 | if test $WINDOWS_64_BIT_ST_SIZE = 1; then | |
33 | AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1], | |
34 | [Define to 1 if Gnulib overrides 'struct stat' on Windows so that | |
35 | struct stat.st_size becomes 64-bit.]) | |
36 | fi | |
37 | ||
8912421c LC |
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 | ||
61cd9dc9 LC |
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> | |
35428fb6 | 49 | ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat |
61cd9dc9 | 50 | mknod mknodat stat utimensat]) |
8912421c LC |
51 | ]) # gl_HEADER_SYS_STAT_H |
52 | ||
53 | AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], | |
54 | [ | |
55 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | |
56 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | |
a927b6c1 | 57 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
f4c79b3c | 58 | dnl Define it also as a C macro, for the benefit of the unit tests. |
a927b6c1 | 59 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
8912421c LC |
60 | ]) |
61 | ||
62 | AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], | |
63 | [ | |
64 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR | |
65 | GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) | |
35428fb6 | 66 | GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) |
8912421c LC |
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]) | |
f29ded4b | 72 | GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) |
8912421c | 73 | GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) |
f29ded4b | 74 | GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) |
8912421c LC |
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 | dnl Assume proper GNU behavior unless another module says otherwise. | |
79 | HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT]) | |
80 | HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT]) | |
81 | HAVE_FUTIMENS=1; AC_SUBST([HAVE_FUTIMENS]) | |
82 | HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD]) | |
83 | HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT]) | |
84 | HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT]) | |
f29ded4b | 85 | HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) |
8912421c | 86 | HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) |
f29ded4b | 87 | HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) |
8912421c LC |
88 | HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT]) |
89 | HAVE_UTIMENSAT=1; AC_SUBST([HAVE_UTIMENSAT]) | |
90 | REPLACE_FSTAT=0; AC_SUBST([REPLACE_FSTAT]) | |
91 | REPLACE_FSTATAT=0; AC_SUBST([REPLACE_FSTATAT]) | |
92 | REPLACE_FUTIMENS=0; AC_SUBST([REPLACE_FUTIMENS]) | |
93 | REPLACE_LSTAT=0; AC_SUBST([REPLACE_LSTAT]) | |
94 | REPLACE_MKDIR=0; AC_SUBST([REPLACE_MKDIR]) | |
f29ded4b LC |
95 | REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) |
96 | REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) | |
8912421c LC |
97 | REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) |
98 | REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) | |
99 | ]) |