unistd_h.m4 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. # unistd_h.m4 serial 66
  2. dnl Copyright (C) 2006-2013 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 Written by Simon Josefsson, Bruno Haible.
  7. AC_DEFUN([gl_UNISTD_H],
  8. [
  9. dnl Use AC_REQUIRE here, so that the default behavior below is expanded
  10. dnl once only, before all statements that occur in other macros.
  11. AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
  12. gl_CHECK_NEXT_HEADERS([unistd.h])
  13. if test $ac_cv_header_unistd_h = yes; then
  14. HAVE_UNISTD_H=1
  15. else
  16. HAVE_UNISTD_H=0
  17. fi
  18. AC_SUBST([HAVE_UNISTD_H])
  19. dnl Ensure the type pid_t gets defined.
  20. AC_REQUIRE([AC_TYPE_PID_T])
  21. dnl Determine WINDOWS_64_BIT_OFF_T.
  22. AC_REQUIRE([gl_TYPE_OFF_T])
  23. dnl Check for declarations of anything we want to poison if the
  24. dnl corresponding gnulib module is not in use.
  25. gl_WARN_ON_USE_PREPARE([[
  26. #if HAVE_UNISTD_H
  27. # include <unistd.h>
  28. #endif
  29. /* Some systems declare various items in the wrong headers. */
  30. #if !(defined __GLIBC__ && !defined __UCLIBC__)
  31. # include <fcntl.h>
  32. # include <stdio.h>
  33. # include <stdlib.h>
  34. # if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
  35. # include <io.h>
  36. # endif
  37. #endif
  38. ]], [chdir chown dup dup2 dup3 environ euidaccess faccessat fchdir fchownat
  39. fdatasync fsync ftruncate getcwd getdomainname getdtablesize getgroups
  40. gethostname getlogin getlogin_r getpagesize
  41. getusershell setusershell endusershell
  42. group_member isatty lchown link linkat lseek pipe pipe2 pread pwrite
  43. readlink readlinkat rmdir sethostname sleep symlink symlinkat ttyname_r
  44. unlink unlinkat usleep])
  45. ])
  46. AC_DEFUN([gl_UNISTD_MODULE_INDICATOR],
  47. [
  48. dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
  49. AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
  50. gl_MODULE_INDICATOR_SET_VARIABLE([$1])
  51. dnl Define it also as a C macro, for the benefit of the unit tests.
  52. gl_MODULE_INDICATOR_FOR_TESTS([$1])
  53. ])
  54. AC_DEFUN([gl_UNISTD_H_DEFAULTS],
  55. [
  56. GNULIB_CHDIR=0; AC_SUBST([GNULIB_CHDIR])
  57. GNULIB_CHOWN=0; AC_SUBST([GNULIB_CHOWN])
  58. GNULIB_CLOSE=0; AC_SUBST([GNULIB_CLOSE])
  59. GNULIB_DUP=0; AC_SUBST([GNULIB_DUP])
  60. GNULIB_DUP2=0; AC_SUBST([GNULIB_DUP2])
  61. GNULIB_DUP3=0; AC_SUBST([GNULIB_DUP3])
  62. GNULIB_ENVIRON=0; AC_SUBST([GNULIB_ENVIRON])
  63. GNULIB_EUIDACCESS=0; AC_SUBST([GNULIB_EUIDACCESS])
  64. GNULIB_FACCESSAT=0; AC_SUBST([GNULIB_FACCESSAT])
  65. GNULIB_FCHDIR=0; AC_SUBST([GNULIB_FCHDIR])
  66. GNULIB_FCHOWNAT=0; AC_SUBST([GNULIB_FCHOWNAT])
  67. GNULIB_FDATASYNC=0; AC_SUBST([GNULIB_FDATASYNC])
  68. GNULIB_FSYNC=0; AC_SUBST([GNULIB_FSYNC])
  69. GNULIB_FTRUNCATE=0; AC_SUBST([GNULIB_FTRUNCATE])
  70. GNULIB_GETCWD=0; AC_SUBST([GNULIB_GETCWD])
  71. GNULIB_GETDOMAINNAME=0; AC_SUBST([GNULIB_GETDOMAINNAME])
  72. GNULIB_GETDTABLESIZE=0; AC_SUBST([GNULIB_GETDTABLESIZE])
  73. GNULIB_GETGROUPS=0; AC_SUBST([GNULIB_GETGROUPS])
  74. GNULIB_GETHOSTNAME=0; AC_SUBST([GNULIB_GETHOSTNAME])
  75. GNULIB_GETLOGIN=0; AC_SUBST([GNULIB_GETLOGIN])
  76. GNULIB_GETLOGIN_R=0; AC_SUBST([GNULIB_GETLOGIN_R])
  77. GNULIB_GETPAGESIZE=0; AC_SUBST([GNULIB_GETPAGESIZE])
  78. GNULIB_GETUSERSHELL=0; AC_SUBST([GNULIB_GETUSERSHELL])
  79. GNULIB_GROUP_MEMBER=0; AC_SUBST([GNULIB_GROUP_MEMBER])
  80. GNULIB_ISATTY=0; AC_SUBST([GNULIB_ISATTY])
  81. GNULIB_LCHOWN=0; AC_SUBST([GNULIB_LCHOWN])
  82. GNULIB_LINK=0; AC_SUBST([GNULIB_LINK])
  83. GNULIB_LINKAT=0; AC_SUBST([GNULIB_LINKAT])
  84. GNULIB_LSEEK=0; AC_SUBST([GNULIB_LSEEK])
  85. GNULIB_PIPE=0; AC_SUBST([GNULIB_PIPE])
  86. GNULIB_PIPE2=0; AC_SUBST([GNULIB_PIPE2])
  87. GNULIB_PREAD=0; AC_SUBST([GNULIB_PREAD])
  88. GNULIB_PWRITE=0; AC_SUBST([GNULIB_PWRITE])
  89. GNULIB_READ=0; AC_SUBST([GNULIB_READ])
  90. GNULIB_READLINK=0; AC_SUBST([GNULIB_READLINK])
  91. GNULIB_READLINKAT=0; AC_SUBST([GNULIB_READLINKAT])
  92. GNULIB_RMDIR=0; AC_SUBST([GNULIB_RMDIR])
  93. GNULIB_SETHOSTNAME=0; AC_SUBST([GNULIB_SETHOSTNAME])
  94. GNULIB_SLEEP=0; AC_SUBST([GNULIB_SLEEP])
  95. GNULIB_SYMLINK=0; AC_SUBST([GNULIB_SYMLINK])
  96. GNULIB_SYMLINKAT=0; AC_SUBST([GNULIB_SYMLINKAT])
  97. GNULIB_TTYNAME_R=0; AC_SUBST([GNULIB_TTYNAME_R])
  98. GNULIB_UNISTD_H_NONBLOCKING=0; AC_SUBST([GNULIB_UNISTD_H_NONBLOCKING])
  99. GNULIB_UNISTD_H_SIGPIPE=0; AC_SUBST([GNULIB_UNISTD_H_SIGPIPE])
  100. GNULIB_UNLINK=0; AC_SUBST([GNULIB_UNLINK])
  101. GNULIB_UNLINKAT=0; AC_SUBST([GNULIB_UNLINKAT])
  102. GNULIB_USLEEP=0; AC_SUBST([GNULIB_USLEEP])
  103. GNULIB_WRITE=0; AC_SUBST([GNULIB_WRITE])
  104. dnl Assume proper GNU behavior unless another module says otherwise.
  105. HAVE_CHOWN=1; AC_SUBST([HAVE_CHOWN])
  106. HAVE_DUP2=1; AC_SUBST([HAVE_DUP2])
  107. HAVE_DUP3=1; AC_SUBST([HAVE_DUP3])
  108. HAVE_EUIDACCESS=1; AC_SUBST([HAVE_EUIDACCESS])
  109. HAVE_FACCESSAT=1; AC_SUBST([HAVE_FACCESSAT])
  110. HAVE_FCHDIR=1; AC_SUBST([HAVE_FCHDIR])
  111. HAVE_FCHOWNAT=1; AC_SUBST([HAVE_FCHOWNAT])
  112. HAVE_FDATASYNC=1; AC_SUBST([HAVE_FDATASYNC])
  113. HAVE_FSYNC=1; AC_SUBST([HAVE_FSYNC])
  114. HAVE_FTRUNCATE=1; AC_SUBST([HAVE_FTRUNCATE])
  115. HAVE_GETDTABLESIZE=1; AC_SUBST([HAVE_GETDTABLESIZE])
  116. HAVE_GETGROUPS=1; AC_SUBST([HAVE_GETGROUPS])
  117. HAVE_GETHOSTNAME=1; AC_SUBST([HAVE_GETHOSTNAME])
  118. HAVE_GETLOGIN=1; AC_SUBST([HAVE_GETLOGIN])
  119. HAVE_GETPAGESIZE=1; AC_SUBST([HAVE_GETPAGESIZE])
  120. HAVE_GROUP_MEMBER=1; AC_SUBST([HAVE_GROUP_MEMBER])
  121. HAVE_LCHOWN=1; AC_SUBST([HAVE_LCHOWN])
  122. HAVE_LINK=1; AC_SUBST([HAVE_LINK])
  123. HAVE_LINKAT=1; AC_SUBST([HAVE_LINKAT])
  124. HAVE_PIPE=1; AC_SUBST([HAVE_PIPE])
  125. HAVE_PIPE2=1; AC_SUBST([HAVE_PIPE2])
  126. HAVE_PREAD=1; AC_SUBST([HAVE_PREAD])
  127. HAVE_PWRITE=1; AC_SUBST([HAVE_PWRITE])
  128. HAVE_READLINK=1; AC_SUBST([HAVE_READLINK])
  129. HAVE_READLINKAT=1; AC_SUBST([HAVE_READLINKAT])
  130. HAVE_SETHOSTNAME=1; AC_SUBST([HAVE_SETHOSTNAME])
  131. HAVE_SLEEP=1; AC_SUBST([HAVE_SLEEP])
  132. HAVE_SYMLINK=1; AC_SUBST([HAVE_SYMLINK])
  133. HAVE_SYMLINKAT=1; AC_SUBST([HAVE_SYMLINKAT])
  134. HAVE_UNLINKAT=1; AC_SUBST([HAVE_UNLINKAT])
  135. HAVE_USLEEP=1; AC_SUBST([HAVE_USLEEP])
  136. HAVE_DECL_ENVIRON=1; AC_SUBST([HAVE_DECL_ENVIRON])
  137. HAVE_DECL_FCHDIR=1; AC_SUBST([HAVE_DECL_FCHDIR])
  138. HAVE_DECL_FDATASYNC=1; AC_SUBST([HAVE_DECL_FDATASYNC])
  139. HAVE_DECL_GETDOMAINNAME=1; AC_SUBST([HAVE_DECL_GETDOMAINNAME])
  140. HAVE_DECL_GETLOGIN_R=1; AC_SUBST([HAVE_DECL_GETLOGIN_R])
  141. HAVE_DECL_GETPAGESIZE=1; AC_SUBST([HAVE_DECL_GETPAGESIZE])
  142. HAVE_DECL_GETUSERSHELL=1; AC_SUBST([HAVE_DECL_GETUSERSHELL])
  143. HAVE_DECL_SETHOSTNAME=1; AC_SUBST([HAVE_DECL_SETHOSTNAME])
  144. HAVE_DECL_TTYNAME_R=1; AC_SUBST([HAVE_DECL_TTYNAME_R])
  145. HAVE_OS_H=0; AC_SUBST([HAVE_OS_H])
  146. HAVE_SYS_PARAM_H=0; AC_SUBST([HAVE_SYS_PARAM_H])
  147. REPLACE_CHOWN=0; AC_SUBST([REPLACE_CHOWN])
  148. REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
  149. REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
  150. REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
  151. REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
  152. REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
  153. REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
  154. REPLACE_GETDOMAINNAME=0; AC_SUBST([REPLACE_GETDOMAINNAME])
  155. REPLACE_GETLOGIN_R=0; AC_SUBST([REPLACE_GETLOGIN_R])
  156. REPLACE_GETGROUPS=0; AC_SUBST([REPLACE_GETGROUPS])
  157. REPLACE_GETPAGESIZE=0; AC_SUBST([REPLACE_GETPAGESIZE])
  158. REPLACE_ISATTY=0; AC_SUBST([REPLACE_ISATTY])
  159. REPLACE_LCHOWN=0; AC_SUBST([REPLACE_LCHOWN])
  160. REPLACE_LINK=0; AC_SUBST([REPLACE_LINK])
  161. REPLACE_LINKAT=0; AC_SUBST([REPLACE_LINKAT])
  162. REPLACE_LSEEK=0; AC_SUBST([REPLACE_LSEEK])
  163. REPLACE_PREAD=0; AC_SUBST([REPLACE_PREAD])
  164. REPLACE_PWRITE=0; AC_SUBST([REPLACE_PWRITE])
  165. REPLACE_READ=0; AC_SUBST([REPLACE_READ])
  166. REPLACE_READLINK=0; AC_SUBST([REPLACE_READLINK])
  167. REPLACE_RMDIR=0; AC_SUBST([REPLACE_RMDIR])
  168. REPLACE_SLEEP=0; AC_SUBST([REPLACE_SLEEP])
  169. REPLACE_SYMLINK=0; AC_SUBST([REPLACE_SYMLINK])
  170. REPLACE_TTYNAME_R=0; AC_SUBST([REPLACE_TTYNAME_R])
  171. REPLACE_UNLINK=0; AC_SUBST([REPLACE_UNLINK])
  172. REPLACE_UNLINKAT=0; AC_SUBST([REPLACE_UNLINKAT])
  173. REPLACE_USLEEP=0; AC_SUBST([REPLACE_USLEEP])
  174. REPLACE_WRITE=0; AC_SUBST([REPLACE_WRITE])
  175. UNISTD_H_HAVE_WINSOCK2_H=0; AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H])
  176. UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS=0;
  177. AC_SUBST([UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS])
  178. ])