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