421
|
1 # vasnprintf.m4 serial 29
|
|
2 dnl Copyright (C) 2002-2004, 2006-2010 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
|
|
7 AC_DEFUN([gl_FUNC_VASNPRINTF],
|
|
8 [
|
|
9 AC_CHECK_FUNCS_ONCE([vasnprintf])
|
|
10 if test $ac_cv_func_vasnprintf = no; then
|
|
11 gl_REPLACE_VASNPRINTF
|
|
12 fi
|
|
13 ])
|
|
14
|
|
15 AC_DEFUN([gl_REPLACE_VASNPRINTF],
|
|
16 [
|
|
17 AC_CHECK_FUNCS_ONCE([vasnprintf])
|
|
18 AC_LIBOBJ([vasnprintf])
|
|
19 AC_LIBOBJ([printf-args])
|
|
20 AC_LIBOBJ([printf-parse])
|
|
21 AC_LIBOBJ([asnprintf])
|
|
22 if test $ac_cv_func_vasnprintf = yes; then
|
|
23 AC_DEFINE([REPLACE_VASNPRINTF], [1],
|
|
24 [Define if vasnprintf exists but is overridden by gnulib.])
|
|
25 fi
|
|
26 gl_PREREQ_PRINTF_ARGS
|
|
27 gl_PREREQ_PRINTF_PARSE
|
|
28 gl_PREREQ_VASNPRINTF
|
|
29 gl_PREREQ_ASNPRINTF
|
|
30 ])
|
|
31
|
|
32 # Prequisites of lib/printf-args.h, lib/printf-args.c.
|
|
33 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
|
|
34 [
|
|
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
36 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
37 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
38 ])
|
|
39
|
|
40 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
|
|
41 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
|
|
42 [
|
|
43 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
44 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
45 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
46 AC_REQUIRE([AC_TYPE_SIZE_T])
|
|
47 AC_CHECK_TYPE([ptrdiff_t], ,
|
|
48 [AC_DEFINE([ptrdiff_t], [long],
|
|
49 [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
|
|
50 ])
|
|
51 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
|
|
52 ])
|
|
53
|
|
54 # Prerequisites of lib/vasnprintf.c.
|
|
55 AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
|
|
56 [
|
|
57 AC_REQUIRE([AC_FUNC_ALLOCA])
|
|
58 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
|
|
59 AC_REQUIRE([gt_TYPE_WCHAR_T])
|
|
60 AC_REQUIRE([gt_TYPE_WINT_T])
|
|
61 AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
|
|
62 dnl Use the _snprintf function only if it is declared (because on NetBSD it
|
|
63 dnl is defined as a weak alias of snprintf; we prefer to use the latter).
|
|
64 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
|
|
65 ])
|
|
66
|
|
67 # Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
|
|
68 # arguments.
|
|
69 AC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
|
|
70 [
|
|
71 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
|
|
72 case "$gl_cv_func_printf_long_double" in
|
|
73 *yes)
|
|
74 ;;
|
|
75 *)
|
|
76 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
77 [Define if the vasnprintf implementation needs special code for
|
|
78 'long double' arguments.])
|
|
79 ;;
|
|
80 esac
|
|
81 ])
|
|
82
|
|
83 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
|
|
84 # arguments.
|
|
85 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
|
|
86 [
|
|
87 AC_REQUIRE([gl_PRINTF_INFINITE])
|
|
88 case "$gl_cv_func_printf_infinite" in
|
|
89 *yes)
|
|
90 ;;
|
|
91 *)
|
|
92 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
|
|
93 [Define if the vasnprintf implementation needs special code for
|
|
94 infinite 'double' arguments.])
|
|
95 ;;
|
|
96 esac
|
|
97 ])
|
|
98
|
|
99 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
|
|
100 # arguments.
|
|
101 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
|
|
102 [
|
|
103 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
|
|
104 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
|
|
105 dnl NEED_PRINTF_LONG_DOUBLE is already set.
|
|
106 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
|
|
107 case "$gl_cv_func_printf_long_double" in
|
|
108 *yes)
|
|
109 case "$gl_cv_func_printf_infinite_long_double" in
|
|
110 *yes)
|
|
111 ;;
|
|
112 *)
|
|
113 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
|
|
114 [Define if the vasnprintf implementation needs special code for
|
|
115 infinite 'long double' arguments.])
|
|
116 ;;
|
|
117 esac
|
|
118 ;;
|
|
119 esac
|
|
120 ])
|
|
121
|
|
122 # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
|
|
123 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
|
|
124 [
|
|
125 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
|
|
126 case "$gl_cv_func_printf_directive_a" in
|
|
127 *yes)
|
|
128 ;;
|
|
129 *)
|
|
130 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
|
|
131 [Define if the vasnprintf implementation needs special code for
|
|
132 the 'a' and 'A' directives.])
|
|
133 AC_CHECK_FUNCS([nl_langinfo])
|
|
134 ;;
|
|
135 esac
|
|
136 ])
|
|
137
|
|
138 # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
|
|
139 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
|
|
140 [
|
|
141 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
|
|
142 case "$gl_cv_func_printf_directive_f" in
|
|
143 *yes)
|
|
144 ;;
|
|
145 *)
|
|
146 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
|
|
147 [Define if the vasnprintf implementation needs special code for
|
|
148 the 'F' directive.])
|
|
149 ;;
|
|
150 esac
|
|
151 ])
|
|
152
|
|
153 # Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
|
|
154 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
|
|
155 [
|
|
156 AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
|
|
157 case "$gl_cv_func_printf_directive_ls" in
|
|
158 *yes)
|
|
159 ;;
|
|
160 *)
|
|
161 AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
|
|
162 [Define if the vasnprintf implementation needs special code for
|
|
163 the 'ls' directive.])
|
|
164 ;;
|
|
165 esac
|
|
166 ])
|
|
167
|
|
168 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
|
|
169 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
|
|
170 [
|
|
171 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
|
|
172 case "$gl_cv_func_printf_flag_grouping" in
|
|
173 *yes)
|
|
174 ;;
|
|
175 *)
|
|
176 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
|
|
177 [Define if the vasnprintf implementation needs special code for the
|
|
178 ' flag.])
|
|
179 ;;
|
|
180 esac
|
|
181 ])
|
|
182
|
|
183 # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
|
|
184 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
|
|
185 [
|
|
186 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
|
|
187 case "$gl_cv_func_printf_flag_leftadjust" in
|
|
188 *yes)
|
|
189 ;;
|
|
190 *)
|
|
191 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
|
|
192 [Define if the vasnprintf implementation needs special code for the
|
|
193 '-' flag.])
|
|
194 ;;
|
|
195 esac
|
|
196 ])
|
|
197
|
|
198 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
|
|
199 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
|
|
200 [
|
|
201 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
|
|
202 case "$gl_cv_func_printf_flag_zero" in
|
|
203 *yes)
|
|
204 ;;
|
|
205 *)
|
|
206 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
|
|
207 [Define if the vasnprintf implementation needs special code for the
|
|
208 0 flag.])
|
|
209 ;;
|
|
210 esac
|
|
211 ])
|
|
212
|
|
213 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
|
|
214 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
|
|
215 [
|
|
216 AC_REQUIRE([gl_PRINTF_PRECISION])
|
|
217 case "$gl_cv_func_printf_precision" in
|
|
218 *yes)
|
|
219 ;;
|
|
220 *)
|
|
221 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
|
|
222 [Define if the vasnprintf implementation needs special code for
|
|
223 supporting large precisions without arbitrary bounds.])
|
|
224 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
|
|
225 [Define if the vasnprintf implementation needs special code for
|
|
226 'double' arguments.])
|
|
227 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
228 [Define if the vasnprintf implementation needs special code for
|
|
229 'long double' arguments.])
|
|
230 ;;
|
|
231 esac
|
|
232 ])
|
|
233
|
|
234 # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
|
|
235 # conditions.
|
|
236 AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
|
|
237 [
|
|
238 AC_REQUIRE([gl_PRINTF_ENOMEM])
|
|
239 case "$gl_cv_func_printf_enomem" in
|
|
240 *yes)
|
|
241 ;;
|
|
242 *)
|
|
243 AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
|
|
244 [Define if the vasnprintf implementation needs special code for
|
|
245 surviving out-of-memory conditions.])
|
|
246 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
|
|
247 [Define if the vasnprintf implementation needs special code for
|
|
248 'double' arguments.])
|
|
249 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
|
|
250 [Define if the vasnprintf implementation needs special code for
|
|
251 'long double' arguments.])
|
|
252 ;;
|
|
253 esac
|
|
254 ])
|
|
255
|
|
256 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
|
|
257 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
|
|
258 [
|
|
259 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
|
|
260 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
|
|
261 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
|
|
262 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
|
|
263 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
|
|
264 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
|
|
265 gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
|
|
266 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
|
|
267 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
|
|
268 gl_PREREQ_VASNPRINTF_FLAG_ZERO
|
|
269 gl_PREREQ_VASNPRINTF_PRECISION
|
|
270 gl_PREREQ_VASNPRINTF_ENOMEM
|
|
271 ])
|
|
272
|
|
273 # Prerequisites of lib/asnprintf.c.
|
|
274 AC_DEFUN([gl_PREREQ_ASNPRINTF],
|
|
275 [
|
|
276 ])
|