sys_stat_h.m4 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # sys_stat_h.m4 serial 28 -*- Autoconf -*-
  2. dnl Copyright (C) 2006-2014 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.
  6. dnl From Eric Blake.
  7. dnl Provide a GNU-like <sys/stat.h>.
  8. AC_DEFUN([gl_HEADER_SYS_STAT_H],
  9. [
  10. AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
  11. dnl Check for broken stat macros.
  12. AC_REQUIRE([AC_HEADER_STAT])
  13. gl_CHECK_NEXT_HEADERS([sys/stat.h])
  14. dnl Ensure the type mode_t gets defined.
  15. AC_REQUIRE([AC_TYPE_MODE_T])
  16. dnl Whether to override 'struct stat'.
  17. m4_ifdef([gl_LARGEFILE], [
  18. AC_REQUIRE([gl_LARGEFILE])
  19. ], [
  20. WINDOWS_64_BIT_ST_SIZE=0
  21. ])
  22. AC_SUBST([WINDOWS_64_BIT_ST_SIZE])
  23. if test $WINDOWS_64_BIT_ST_SIZE = 1; then
  24. AC_DEFINE([_GL_WINDOWS_64_BIT_ST_SIZE], [1],
  25. [Define to 1 if Gnulib overrides 'struct stat' on Windows so that
  26. struct stat.st_size becomes 64-bit.])
  27. fi
  28. dnl Define types that are supposed to be defined in <sys/types.h> or
  29. dnl <sys/stat.h>.
  30. AC_CHECK_TYPE([nlink_t], [],
  31. [AC_DEFINE([nlink_t], [int],
  32. [Define to the type of st_nlink in struct stat, or a supertype.])],
  33. [#include <sys/types.h>
  34. #include <sys/stat.h>])
  35. dnl Check for declarations of anything we want to poison if the
  36. dnl corresponding gnulib module is not in use.
  37. gl_WARN_ON_USE_PREPARE([[#include <sys/stat.h>
  38. ]], [fchmodat fstat fstatat futimens lchmod lstat mkdirat mkfifo mkfifoat
  39. mknod mknodat stat utimensat])
  40. ]) # gl_HEADER_SYS_STAT_H
  41. AC_DEFUN([gl_SYS_STAT_MODULE_INDICATOR],
  42. [
  43. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  44. AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
  45. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  46. dnl Define it also as a C macro, for the benefit of the unit tests.
  47. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  48. ])
  49. AC_DEFUN([gl_SYS_STAT_H_DEFAULTS],
  50. [
  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])
  86. ])