sys_stat_h.m4 3.3 KB

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