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