1 # vasnprintf.m4 serial 26
2 dnl Copyright (C) 2002-2004, 2006-2009 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.
7 AC_DEFUN([gl_FUNC_VASNPRINTF],
9 AC_CHECK_FUNCS_ONCE([vasnprintf])
10 if test $ac_cv_func_vasnprintf = no; then
15 AC_DEFUN([gl_REPLACE_VASNPRINTF],
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.])
27 gl_PREREQ_PRINTF_PARSE
32 # Prequisites of lib/printf-args.h, lib/printf-args.c.
33 AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
35 AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
36 AC_REQUIRE([gt_TYPE_WCHAR_T])
37 AC_REQUIRE([gt_TYPE_WINT_T])
40 # Prequisites of lib/printf-parse.h, lib/printf-parse.c.
41 AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
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.])
51 AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
54 # Prerequisites of lib/vasnprintf.c.
55 AC_DEFUN([gl_PREREQ_VASNPRINTF],
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 wcslen])
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>])
67 # Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
69 AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
71 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
72 case "$gl_cv_func_printf_long_double" in
76 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
77 [Define if the vasnprintf implementation needs special code for
78 'long double' arguments.])
83 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
85 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
87 AC_REQUIRE([gl_PRINTF_INFINITE])
88 case "$gl_cv_func_printf_infinite" in
92 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
93 [Define if the vasnprintf implementation needs special code for
94 infinite 'double' arguments.])
99 # Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
101 AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
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
109 case "$gl_cv_func_printf_infinite_long_double" in
113 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
114 [Define if the vasnprintf implementation needs special code for
115 infinite 'long double' arguments.])
122 # Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
123 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
125 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
126 case "$gl_cv_func_printf_directive_a" in
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])
138 # Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
139 AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
141 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
142 case "$gl_cv_func_printf_directive_f" in
146 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
147 [Define if the vasnprintf implementation needs special code for
153 # Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
154 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
156 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
157 case "$gl_cv_func_printf_flag_grouping" in
161 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
162 [Define if the vasnprintf implementation needs special code for the
168 # Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
169 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
171 AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
172 case "$gl_cv_func_printf_flag_leftadjust" in
176 AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
177 [Define if the vasnprintf implementation needs special code for the
183 # Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
184 AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
186 AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
187 case "$gl_cv_func_printf_flag_zero" in
191 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
192 [Define if the vasnprintf implementation needs special code for the
198 # Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
199 AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
201 AC_REQUIRE([gl_PRINTF_PRECISION])
202 case "$gl_cv_func_printf_precision" in
206 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
207 [Define if the vasnprintf implementation needs special code for
208 supporting large precisions without arbitrary bounds.])
209 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
210 [Define if the vasnprintf implementation needs special code for
211 'double' arguments.])
212 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
213 [Define if the vasnprintf implementation needs special code for
214 'long double' arguments.])
219 # Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
221 AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
223 AC_REQUIRE([gl_PRINTF_ENOMEM])
224 case "$gl_cv_func_printf_enomem" in
228 AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
229 [Define if the vasnprintf implementation needs special code for
230 surviving out-of-memory conditions.])
231 AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
232 [Define if the vasnprintf implementation needs special code for
233 'double' arguments.])
234 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
235 [Define if the vasnprintf implementation needs special code for
236 'long double' arguments.])
241 # Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
242 AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
244 AC_REQUIRE([gl_PREREQ_VASNPRINTF])
245 gl_PREREQ_VASNPRINTF_LONG_DOUBLE
246 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
247 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
248 gl_PREREQ_VASNPRINTF_DIRECTIVE_A
249 gl_PREREQ_VASNPRINTF_DIRECTIVE_F
250 gl_PREREQ_VASNPRINTF_FLAG_GROUPING
251 gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
252 gl_PREREQ_VASNPRINTF_FLAG_ZERO
253 gl_PREREQ_VASNPRINTF_PRECISION
254 gl_PREREQ_VASNPRINTF_ENOMEM
257 # Prerequisites of lib/asnprintf.c.
258 AC_DEFUN([gl_PREREQ_ASNPRINTF],