2 dnl Copyright (C) 2007-2015 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.
9 dnl For __USE_MINGW_ANSI_STDIO
10 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
12 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
13 gl_NEXT_HEADERS([stdio.h])
15 dnl Determine whether __USE_MINGW_ANSI_STDIO makes printf and
16 dnl inttypes.h behave like gnu instead of system; we must give our
17 dnl printf wrapper the right attribute to match.
18 AC_CACHE_CHECK([whether inttypes macros match system or gnu printf],
19 [gl_cv_func_printf_attribute_flavor],
20 [AC_EGREP_CPP([findme .(ll|j)d. findme],
21 [#define __STDC_FORMAT_MACROS 1
25 ], [gl_cv_func_printf_attribute_flavor=gnu],
26 [gl_cv_func_printf_attribute_flavor=system])])
27 if test "$gl_cv_func_printf_attribute_flavor" = gnu; then
28 AC_DEFINE([GNULIB_PRINTF_ATTRIBUTE_FLAVOR_GNU], [1],
29 [Define to 1 if printf and friends should be labeled with
30 attribute "__gnu_printf__" instead of "__printf__"])
33 dnl No need to create extra modules for these functions. Everyone who uses
34 dnl <stdio.h> likely needs them.
36 gl_MODULE_INDICATOR([fscanf])
38 gl_MODULE_INDICATOR([scanf])
44 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-read.c"
45 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
46 dnl also an optimization, to avoid performing a configure check whose result
47 dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
48 dnl or GNULIB_NONBLOCKING redundant.
49 m4_ifdef([gl_NONBLOCKING_IO], [
51 if test $gl_cv_have_nonblocking != yes; then
52 REPLACE_STDIO_READ_FUNCS=1
53 AC_LIBOBJ([stdio-read])
57 dnl No need to create extra modules for these functions. Everyone who uses
58 dnl <stdio.h> likely needs them.
69 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
70 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
71 dnl also an optimization, to avoid performing a configure check whose result
72 dnl is not used. But it does not make the test of GNULIB_STDIO_H_SIGPIPE or
73 dnl GNULIB_SIGPIPE redundant.
74 m4_ifdef([gl_SIGNAL_SIGPIPE], [
76 if test $gl_cv_header_signal_h_SIGPIPE != yes; then
77 REPLACE_STDIO_WRITE_FUNCS=1
78 AC_LIBOBJ([stdio-write])
81 dnl This ifdef is necessary to avoid an error "missing file lib/stdio-write.c"
82 dnl "expected source file, required through AC_LIBSOURCES, not found". It is
83 dnl also an optimization, to avoid performing a configure check whose result
84 dnl is not used. But it does not make the test of GNULIB_STDIO_H_NONBLOCKING
85 dnl or GNULIB_NONBLOCKING redundant.
86 m4_ifdef([gl_NONBLOCKING_IO], [
88 if test $gl_cv_have_nonblocking != yes; then
89 REPLACE_STDIO_WRITE_FUNCS=1
90 AC_LIBOBJ([stdio-write])
94 dnl Check for declarations of anything we want to poison if the
95 dnl corresponding gnulib module is not in use, and which is not
96 dnl guaranteed by both C89 and C11.
97 gl_WARN_ON_USE_PREPARE([[#include <stdio.h>
98 ]], [dprintf fpurge fseeko ftello getdelim getline gets pclose popen
99 renameat snprintf tmpfile vdprintf vsnprintf])
102 AC_DEFUN([gl_STDIO_MODULE_INDICATOR],
104 dnl Use AC_REQUIRE here, so that the default settings are expanded once only.
105 AC_REQUIRE([gl_STDIO_H_DEFAULTS])
106 gl_MODULE_INDICATOR_SET_VARIABLE([$1])
107 dnl Define it also as a C macro, for the benefit of the unit tests.
108 gl_MODULE_INDICATOR_FOR_TESTS([$1])
111 AC_DEFUN([gl_STDIO_H_DEFAULTS],
113 GNULIB_DPRINTF=0; AC_SUBST([GNULIB_DPRINTF])
114 GNULIB_FCLOSE=0; AC_SUBST([GNULIB_FCLOSE])
115 GNULIB_FDOPEN=0; AC_SUBST([GNULIB_FDOPEN])
116 GNULIB_FFLUSH=0; AC_SUBST([GNULIB_FFLUSH])
117 GNULIB_FGETC=0; AC_SUBST([GNULIB_FGETC])
118 GNULIB_FGETS=0; AC_SUBST([GNULIB_FGETS])
119 GNULIB_FOPEN=0; AC_SUBST([GNULIB_FOPEN])
120 GNULIB_FPRINTF=0; AC_SUBST([GNULIB_FPRINTF])
121 GNULIB_FPRINTF_POSIX=0; AC_SUBST([GNULIB_FPRINTF_POSIX])
122 GNULIB_FPURGE=0; AC_SUBST([GNULIB_FPURGE])
123 GNULIB_FPUTC=0; AC_SUBST([GNULIB_FPUTC])
124 GNULIB_FPUTS=0; AC_SUBST([GNULIB_FPUTS])
125 GNULIB_FREAD=0; AC_SUBST([GNULIB_FREAD])
126 GNULIB_FREOPEN=0; AC_SUBST([GNULIB_FREOPEN])
127 GNULIB_FSCANF=0; AC_SUBST([GNULIB_FSCANF])
128 GNULIB_FSEEK=0; AC_SUBST([GNULIB_FSEEK])
129 GNULIB_FSEEKO=0; AC_SUBST([GNULIB_FSEEKO])
130 GNULIB_FTELL=0; AC_SUBST([GNULIB_FTELL])
131 GNULIB_FTELLO=0; AC_SUBST([GNULIB_FTELLO])
132 GNULIB_FWRITE=0; AC_SUBST([GNULIB_FWRITE])
133 GNULIB_GETC=0; AC_SUBST([GNULIB_GETC])
134 GNULIB_GETCHAR=0; AC_SUBST([GNULIB_GETCHAR])
135 GNULIB_GETDELIM=0; AC_SUBST([GNULIB_GETDELIM])
136 GNULIB_GETLINE=0; AC_SUBST([GNULIB_GETLINE])
137 GNULIB_OBSTACK_PRINTF=0; AC_SUBST([GNULIB_OBSTACK_PRINTF])
138 GNULIB_OBSTACK_PRINTF_POSIX=0; AC_SUBST([GNULIB_OBSTACK_PRINTF_POSIX])
139 GNULIB_PCLOSE=0; AC_SUBST([GNULIB_PCLOSE])
140 GNULIB_PERROR=0; AC_SUBST([GNULIB_PERROR])
141 GNULIB_POPEN=0; AC_SUBST([GNULIB_POPEN])
142 GNULIB_PRINTF=0; AC_SUBST([GNULIB_PRINTF])
143 GNULIB_PRINTF_POSIX=0; AC_SUBST([GNULIB_PRINTF_POSIX])
144 GNULIB_PUTC=0; AC_SUBST([GNULIB_PUTC])
145 GNULIB_PUTCHAR=0; AC_SUBST([GNULIB_PUTCHAR])
146 GNULIB_PUTS=0; AC_SUBST([GNULIB_PUTS])
147 GNULIB_REMOVE=0; AC_SUBST([GNULIB_REMOVE])
148 GNULIB_RENAME=0; AC_SUBST([GNULIB_RENAME])
149 GNULIB_RENAMEAT=0; AC_SUBST([GNULIB_RENAMEAT])
150 GNULIB_SCANF=0; AC_SUBST([GNULIB_SCANF])
151 GNULIB_SNPRINTF=0; AC_SUBST([GNULIB_SNPRINTF])
152 GNULIB_SPRINTF_POSIX=0; AC_SUBST([GNULIB_SPRINTF_POSIX])
153 GNULIB_STDIO_H_NONBLOCKING=0; AC_SUBST([GNULIB_STDIO_H_NONBLOCKING])
154 GNULIB_STDIO_H_SIGPIPE=0; AC_SUBST([GNULIB_STDIO_H_SIGPIPE])
155 GNULIB_TMPFILE=0; AC_SUBST([GNULIB_TMPFILE])
156 GNULIB_VASPRINTF=0; AC_SUBST([GNULIB_VASPRINTF])
157 GNULIB_VFSCANF=0; AC_SUBST([GNULIB_VFSCANF])
158 GNULIB_VSCANF=0; AC_SUBST([GNULIB_VSCANF])
159 GNULIB_VDPRINTF=0; AC_SUBST([GNULIB_VDPRINTF])
160 GNULIB_VFPRINTF=0; AC_SUBST([GNULIB_VFPRINTF])
161 GNULIB_VFPRINTF_POSIX=0; AC_SUBST([GNULIB_VFPRINTF_POSIX])
162 GNULIB_VPRINTF=0; AC_SUBST([GNULIB_VPRINTF])
163 GNULIB_VPRINTF_POSIX=0; AC_SUBST([GNULIB_VPRINTF_POSIX])
164 GNULIB_VSNPRINTF=0; AC_SUBST([GNULIB_VSNPRINTF])
165 GNULIB_VSPRINTF_POSIX=0; AC_SUBST([GNULIB_VSPRINTF_POSIX])
166 dnl Assume proper GNU behavior unless another module says otherwise.
167 HAVE_DECL_FPURGE=1; AC_SUBST([HAVE_DECL_FPURGE])
168 HAVE_DECL_FSEEKO=1; AC_SUBST([HAVE_DECL_FSEEKO])
169 HAVE_DECL_FTELLO=1; AC_SUBST([HAVE_DECL_FTELLO])
170 HAVE_DECL_GETDELIM=1; AC_SUBST([HAVE_DECL_GETDELIM])
171 HAVE_DECL_GETLINE=1; AC_SUBST([HAVE_DECL_GETLINE])
172 HAVE_DECL_OBSTACK_PRINTF=1; AC_SUBST([HAVE_DECL_OBSTACK_PRINTF])
173 HAVE_DECL_SNPRINTF=1; AC_SUBST([HAVE_DECL_SNPRINTF])
174 HAVE_DECL_VSNPRINTF=1; AC_SUBST([HAVE_DECL_VSNPRINTF])
175 HAVE_DPRINTF=1; AC_SUBST([HAVE_DPRINTF])
176 HAVE_FSEEKO=1; AC_SUBST([HAVE_FSEEKO])
177 HAVE_FTELLO=1; AC_SUBST([HAVE_FTELLO])
178 HAVE_PCLOSE=1; AC_SUBST([HAVE_PCLOSE])
179 HAVE_POPEN=1; AC_SUBST([HAVE_POPEN])
180 HAVE_RENAMEAT=1; AC_SUBST([HAVE_RENAMEAT])
181 HAVE_VASPRINTF=1; AC_SUBST([HAVE_VASPRINTF])
182 HAVE_VDPRINTF=1; AC_SUBST([HAVE_VDPRINTF])
183 REPLACE_DPRINTF=0; AC_SUBST([REPLACE_DPRINTF])
184 REPLACE_FCLOSE=0; AC_SUBST([REPLACE_FCLOSE])
185 REPLACE_FDOPEN=0; AC_SUBST([REPLACE_FDOPEN])
186 REPLACE_FFLUSH=0; AC_SUBST([REPLACE_FFLUSH])
187 REPLACE_FOPEN=0; AC_SUBST([REPLACE_FOPEN])
188 REPLACE_FPRINTF=0; AC_SUBST([REPLACE_FPRINTF])
189 REPLACE_FPURGE=0; AC_SUBST([REPLACE_FPURGE])
190 REPLACE_FREOPEN=0; AC_SUBST([REPLACE_FREOPEN])
191 REPLACE_FSEEK=0; AC_SUBST([REPLACE_FSEEK])
192 REPLACE_FSEEKO=0; AC_SUBST([REPLACE_FSEEKO])
193 REPLACE_FTELL=0; AC_SUBST([REPLACE_FTELL])
194 REPLACE_FTELLO=0; AC_SUBST([REPLACE_FTELLO])
195 REPLACE_GETDELIM=0; AC_SUBST([REPLACE_GETDELIM])
196 REPLACE_GETLINE=0; AC_SUBST([REPLACE_GETLINE])
197 REPLACE_OBSTACK_PRINTF=0; AC_SUBST([REPLACE_OBSTACK_PRINTF])
198 REPLACE_PERROR=0; AC_SUBST([REPLACE_PERROR])
199 REPLACE_POPEN=0; AC_SUBST([REPLACE_POPEN])
200 REPLACE_PRINTF=0; AC_SUBST([REPLACE_PRINTF])
201 REPLACE_REMOVE=0; AC_SUBST([REPLACE_REMOVE])
202 REPLACE_RENAME=0; AC_SUBST([REPLACE_RENAME])
203 REPLACE_RENAMEAT=0; AC_SUBST([REPLACE_RENAMEAT])
204 REPLACE_SNPRINTF=0; AC_SUBST([REPLACE_SNPRINTF])
205 REPLACE_SPRINTF=0; AC_SUBST([REPLACE_SPRINTF])
206 REPLACE_STDIO_READ_FUNCS=0; AC_SUBST([REPLACE_STDIO_READ_FUNCS])
207 REPLACE_STDIO_WRITE_FUNCS=0; AC_SUBST([REPLACE_STDIO_WRITE_FUNCS])
208 REPLACE_TMPFILE=0; AC_SUBST([REPLACE_TMPFILE])
209 REPLACE_VASPRINTF=0; AC_SUBST([REPLACE_VASPRINTF])
210 REPLACE_VDPRINTF=0; AC_SUBST([REPLACE_VDPRINTF])
211 REPLACE_VFPRINTF=0; AC_SUBST([REPLACE_VFPRINTF])
212 REPLACE_VPRINTF=0; AC_SUBST([REPLACE_VPRINTF])
213 REPLACE_VSNPRINTF=0; AC_SUBST([REPLACE_VSNPRINTF])
214 REPLACE_VSPRINTF=0; AC_SUBST([REPLACE_VSPRINTF])