Commit | Line | Data |
---|---|---|
af07e104 AW |
1 | # sys_stat_h.m4 serial 28 -*- Autoconf -*- |
2 | dnl Copyright (C) 2006-2013 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 | ||
8912421c LC |
14 | dnl Check for broken stat macros. |
15 | AC_REQUIRE([AC_HEADER_STAT]) | |
16 | ||
17 | gl_CHECK_NEXT_HEADERS([sys/stat.h]) | |
18 | ||
35428fb6 LC |
19 | dnl Ensure the type mode_t gets defined. |
20 | AC_REQUIRE([AC_TYPE_MODE_T]) | |
21 | ||
005de2e8 LC |
22 | dnl Whether to override 'struct stat'. |
23 | m4_ifdef([gl_LARGEFILE], [ | |
24 | AC_REQUIRE([gl_LARGEFILE]) | |
25 | ], [ | |
26 | WINDOWS_64_BIT_ST_SIZE=0 | |
27 | ]) | |
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.]) | |
33 | fi | |
34 | ||
8912421c LC |
35 | dnl Define types that are supposed to be defined in <sys/types.h> or |
36 | dnl <sys/stat.h>. | |
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>]) | |
42 | ||
61cd9dc9 LC |
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> | |
35428fb6 | 46 | ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat |
61cd9dc9 | 47 | mknod mknodat stat utimensat]) |
8912421c LC |
48 | ]) # gl_HEADER_SYS_STAT_H |
49 | ||
50 | AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR], | |
51 | [ | |
52 | dnl Use AC_REQUIRE here, so that the default settings are expanded once only. | |
53 | AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS]) | |
a927b6c1 | 54 | gl_MODULE_INDICATOR_SET_VARIABLE([$1]) |
f4c79b3c | 55 | dnl Define it also as a C macro, for the benefit of the unit tests. |
a927b6c1 | 56 | gl_MODULE_INDICATOR_FOR_TESTS([$1]) |
8912421c LC |
57 | ]) |
58 | ||
59 | AC_DEFUN([gl_SYS_STAT_H_DEFAULTS], | |
60 | [ | |
61 | AC_REQUIRE([gl_UNISTD_H_DEFAULTS]) dnl for REPLACE_FCHDIR | |
62 | GNULIB_FCHMODAT=0; AC_SUBST([GNULIB_FCHMODAT]) | |
35428fb6 | 63 | GNULIB_FSTAT=0; AC_SUBST([GNULIB_FSTAT]) |
8912421c LC |
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]) | |
f29ded4b | 69 | GNULIB_MKFIFO=0; AC_SUBST([GNULIB_MKFIFO]) |
8912421c | 70 | GNULIB_MKFIFOAT=0; AC_SUBST([GNULIB_MKFIFOAT]) |
f29ded4b | 71 | GNULIB_MKNOD=0; AC_SUBST([GNULIB_MKNOD]) |
8912421c LC |
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]) | |
f29ded4b | 82 | HAVE_MKFIFO=1; AC_SUBST([HAVE_MKFIFO]) |
8912421c | 83 | HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT]) |
f29ded4b | 84 | HAVE_MKNOD=1; AC_SUBST([HAVE_MKNOD]) |
8912421c LC |
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]) | |
f29ded4b LC |
92 | REPLACE_MKFIFO=0; AC_SUBST([REPLACE_MKFIFO]) |
93 | REPLACE_MKNOD=0; AC_SUBST([REPLACE_MKNOD]) | |
8912421c LC |
94 | REPLACE_STAT=0; AC_SUBST([REPLACE_STAT]) |
95 | REPLACE_UTIMENSAT=0; AC_SUBST([REPLACE_UTIMENSAT]) | |
96 | ]) |