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