1# vasnprintf.m4 serial 17
2dnl Copyright (C) 2002-2004, 2006-2007 Free Software Foundation, Inc.
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
7AC_DEFUN([gl_FUNC_VASNPRINTF],
8[
9  AC_REQUIRE([gl_EOVERFLOW])
10  AC_CHECK_FUNCS_ONCE([vasnprintf])
11  if test $ac_cv_func_vasnprintf = no; then
12    gl_REPLACE_VASNPRINTF
13  fi
14])
15
16AC_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
33# Prequisites of lib/printf-args.h, lib/printf-args.c.
34AC_DEFUN([gl_PREREQ_PRINTF_ARGS],
35[
36  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
37  AC_REQUIRE([gt_TYPE_WCHAR_T])
38  AC_REQUIRE([gt_TYPE_WINT_T])
39])
40
41# Prequisites of lib/printf-parse.h, lib/printf-parse.c.
42AC_DEFUN([gl_PREREQ_PRINTF_PARSE],
43[
44  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
45  AC_REQUIRE([gt_TYPE_WCHAR_T])
46  AC_REQUIRE([gt_TYPE_WINT_T])
47  AC_REQUIRE([AC_TYPE_SIZE_T])
48  AC_CHECK_TYPES(ptrdiff_t)
49  AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
50])
51
52# Prerequisites of lib/vasnprintf.c.
53AC_DEFUN([gl_PREREQ_VASNPRINTF],
54[
55  AC_REQUIRE([AC_FUNC_ALLOCA])
56  AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
57  AC_REQUIRE([gt_TYPE_WCHAR_T])
58  AC_REQUIRE([gt_TYPE_WINT_T])
59  AC_CHECK_FUNCS(snprintf wcslen)
60])
61
62# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
63# arguments.
64AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
65[
66  AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
67  case "$gl_cv_func_printf_long_double" in
68    *yes)
69      ;;
70    *)
71      AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1,
72        [Define if the vasnprintf implementation needs special code for
73         'long double' arguments.])
74      ;;
75  esac
76])
77
78# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
79# arguments.
80AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
81[
82  AC_REQUIRE([gl_PRINTF_INFINITE])
83  case "$gl_cv_func_printf_infinite" in
84    *yes)
85      ;;
86    *)
87      AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1,
88        [Define if the vasnprintf implementation needs special code for
89         infinite 'double' arguments.])
90      ;;
91  esac
92])
93
94# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
95# arguments.
96AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
97[
98  AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
99  dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
100  dnl NEED_PRINTF_LONG_DOUBLE is already set.
101  AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
102  case "$gl_cv_func_printf_long_double" in
103    *yes)
104      case "$gl_cv_func_printf_infinite" in
105        *yes)
106          ;;
107        *)
108          AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1,
109            [Define if the vasnprintf implementation needs special code for
110             infinite 'long double' arguments.])
111          ;;
112      esac
113      ;;
114  esac
115])
116
117# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
118AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
119[
120  AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
121  case "$gl_cv_func_printf_directive_a" in
122    *yes)
123      ;;
124    *)
125      AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1,
126        [Define if the vasnprintf implementation needs special code for
127         the 'a' and 'A' directives.])
128      AC_CHECK_FUNCS([nl_langinfo])
129      ;;
130  esac
131])
132
133# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
134AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
135[
136  AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
137  case "$gl_cv_func_printf_directive_f" in
138    *yes)
139      ;;
140    *)
141      AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1,
142        [Define if the vasnprintf implementation needs special code for
143         the 'F' directive.])
144      ;;
145  esac
146])
147
148# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
149AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
150[
151  AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
152  case "$gl_cv_func_printf_flag_grouping" in
153    *yes)
154      ;;
155    *)
156      AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1,
157        [Define if the vasnprintf implementation needs special code for the
158         ' flag.])
159      ;;
160  esac
161])
162
163# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
164AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
165[
166  AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
167  case "$gl_cv_func_printf_flag_zero" in
168    *yes)
169      ;;
170    *)
171      AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1,
172        [Define if the vasnprintf implementation needs special code for the
173         0 flag.])
174      ;;
175  esac
176])
177
178# Prerequisites of lib/asnprintf.c.
179AC_DEFUN([gl_PREREQ_ASNPRINTF],
180[
181])
182