1# vasnprintf.m4 serial 22 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 dnl Use the _snprintf function only if it is declared (because on NetBSD it 61 dnl is defined as a weak alias of snprintf; we prefer to use the latter). 62 AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>]) 63]) 64 65# Extra prerequisites of lib/vasnprintf.c for supporting 'long double' 66# arguments. 67AC_DEFUN([gl_PREREQ_VASNPRINTF_LONG_DOUBLE], 68[ 69 AC_REQUIRE([gl_PRINTF_LONG_DOUBLE]) 70 case "$gl_cv_func_printf_long_double" in 71 *yes) 72 ;; 73 *) 74 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, 75 [Define if the vasnprintf implementation needs special code for 76 'long double' arguments.]) 77 ;; 78 esac 79]) 80 81# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double' 82# arguments. 83AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE], 84[ 85 AC_REQUIRE([gl_PRINTF_INFINITE]) 86 case "$gl_cv_func_printf_infinite" in 87 *yes) 88 ;; 89 *) 90 AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], 1, 91 [Define if the vasnprintf implementation needs special code for 92 infinite 'double' arguments.]) 93 ;; 94 esac 95]) 96 97# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double' 98# arguments. 99AC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE], 100[ 101 AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE]) 102 dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if 103 dnl NEED_PRINTF_LONG_DOUBLE is already set. 104 AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE]) 105 case "$gl_cv_func_printf_long_double" in 106 *yes) 107 case "$gl_cv_func_printf_infinite_long_double" in 108 *yes) 109 ;; 110 *) 111 AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], 1, 112 [Define if the vasnprintf implementation needs special code for 113 infinite 'long double' arguments.]) 114 ;; 115 esac 116 ;; 117 esac 118]) 119 120# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive. 121AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A], 122[ 123 AC_REQUIRE([gl_PRINTF_DIRECTIVE_A]) 124 case "$gl_cv_func_printf_directive_a" in 125 *yes) 126 ;; 127 *) 128 AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], 1, 129 [Define if the vasnprintf implementation needs special code for 130 the 'a' and 'A' directives.]) 131 AC_CHECK_FUNCS([nl_langinfo]) 132 ;; 133 esac 134]) 135 136# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive. 137AC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F], 138[ 139 AC_REQUIRE([gl_PRINTF_DIRECTIVE_F]) 140 case "$gl_cv_func_printf_directive_f" in 141 *yes) 142 ;; 143 *) 144 AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], 1, 145 [Define if the vasnprintf implementation needs special code for 146 the 'F' directive.]) 147 ;; 148 esac 149]) 150 151# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag. 152AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING], 153[ 154 AC_REQUIRE([gl_PRINTF_FLAG_GROUPING]) 155 case "$gl_cv_func_printf_flag_grouping" in 156 *yes) 157 ;; 158 *) 159 AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], 1, 160 [Define if the vasnprintf implementation needs special code for the 161 ' flag.]) 162 ;; 163 esac 164]) 165 166# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag. 167AC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO], 168[ 169 AC_REQUIRE([gl_PRINTF_FLAG_ZERO]) 170 case "$gl_cv_func_printf_flag_zero" in 171 *yes) 172 ;; 173 *) 174 AC_DEFINE([NEED_PRINTF_FLAG_ZERO], 1, 175 [Define if the vasnprintf implementation needs special code for the 176 0 flag.]) 177 ;; 178 esac 179]) 180 181# Extra prerequisites of lib/vasnprintf.c for supporting large precisions. 182AC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION], 183[ 184 AC_REQUIRE([gl_PRINTF_PRECISION]) 185 case "$gl_cv_func_printf_precision" in 186 *yes) 187 ;; 188 *) 189 AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], 1, 190 [Define if the vasnprintf implementation needs special code for 191 supporting large precisions without arbitrary bounds.]) 192 AC_DEFINE([NEED_PRINTF_DOUBLE], 1, 193 [Define if the vasnprintf implementation needs special code for 194 'double' arguments.]) 195 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, 196 [Define if the vasnprintf implementation needs special code for 197 'long double' arguments.]) 198 ;; 199 esac 200]) 201 202# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory 203# conditions. 204AC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM], 205[ 206 AC_REQUIRE([gl_PRINTF_ENOMEM]) 207 case "$gl_cv_func_printf_enomem" in 208 *yes) 209 ;; 210 *) 211 AC_DEFINE([NEED_PRINTF_ENOMEM], 1, 212 [Define if the vasnprintf implementation needs special code for 213 surviving out-of-memory conditions.]) 214 AC_DEFINE([NEED_PRINTF_DOUBLE], 1, 215 [Define if the vasnprintf implementation needs special code for 216 'double' arguments.]) 217 AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], 1, 218 [Define if the vasnprintf implementation needs special code for 219 'long double' arguments.]) 220 ;; 221 esac 222]) 223 224# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance. 225AC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS], 226[ 227 AC_REQUIRE([gl_PREREQ_VASNPRINTF]) 228 gl_PREREQ_VASNPRINTF_LONG_DOUBLE 229 gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE 230 gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE 231 gl_PREREQ_VASNPRINTF_DIRECTIVE_A 232 gl_PREREQ_VASNPRINTF_DIRECTIVE_F 233 gl_PREREQ_VASNPRINTF_FLAG_GROUPING 234 gl_PREREQ_VASNPRINTF_FLAG_ZERO 235 gl_PREREQ_VASNPRINTF_PRECISION 236 gl_PREREQ_VASNPRINTF_ENOMEM 237]) 238 239# Prerequisites of lib/asnprintf.c. 240AC_DEFUN([gl_PREREQ_ASNPRINTF], 241[ 242]) 243