2N/A# vasnprintf.m4 serial 31
2N/Adnl Copyright (C) 2002-2004, 2006-2010 Free Software Foundation, Inc.
2N/Adnl This file is free software; the Free Software Foundation
2N/Adnl gives unlimited permission to copy and/or distribute it,
2N/Adnl with or without modifications, as long as this notice is preserved.
2N/A
2N/AAC_DEFUN([gl_FUNC_VASNPRINTF],
2N/A[
2N/A AC_CHECK_FUNCS_ONCE([vasnprintf])
2N/A if test $ac_cv_func_vasnprintf = no; then
2N/A gl_REPLACE_VASNPRINTF
2N/A fi
2N/A])
2N/A
2N/AAC_DEFUN([gl_REPLACE_VASNPRINTF],
2N/A[
2N/A AC_CHECK_FUNCS_ONCE([vasnprintf])
2N/A AC_LIBOBJ([vasnprintf])
2N/A AC_LIBOBJ([printf-args])
2N/A AC_LIBOBJ([printf-parse])
2N/A AC_LIBOBJ([asnprintf])
2N/A if test $ac_cv_func_vasnprintf = yes; then
2N/A AC_DEFINE([REPLACE_VASNPRINTF], [1],
2N/A [Define if vasnprintf exists but is overridden by gnulib.])
2N/A fi
2N/A gl_PREREQ_PRINTF_ARGS
2N/A gl_PREREQ_PRINTF_PARSE
2N/A gl_PREREQ_VASNPRINTF
2N/A gl_PREREQ_ASNPRINTF
2N/A])
2N/A
2N/A# Prequisites of lib/printf-args.h, lib/printf-args.c.
2N/AAC_DEFUN([gl_PREREQ_PRINTF_ARGS],
2N/A[
2N/A AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
2N/A AC_REQUIRE([gt_TYPE_WCHAR_T])
2N/A AC_REQUIRE([gt_TYPE_WINT_T])
2N/A])
2N/A
2N/A# Prequisites of lib/printf-parse.h, lib/printf-parse.c.
2N/AAC_DEFUN([gl_PREREQ_PRINTF_PARSE],
2N/A[
2N/A AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
2N/A AC_REQUIRE([gt_TYPE_WCHAR_T])
2N/A AC_REQUIRE([gt_TYPE_WINT_T])
2N/A AC_REQUIRE([AC_TYPE_SIZE_T])
2N/A AC_CHECK_TYPE([ptrdiff_t], ,
2N/A [AC_DEFINE([ptrdiff_t], [long],
2N/A [Define as the type of the result of subtracting two pointers, if the system doesn't define it.])
2N/A ])
2N/A AC_REQUIRE([gt_AC_TYPE_INTMAX_T])
2N/A])
2N/A
2N/A# Prerequisites of lib/vasnprintf.c.
2N/AAC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF],
2N/A[
2N/A AC_REQUIRE([AC_C_INLINE])
2N/A AC_REQUIRE([AC_FUNC_ALLOCA])
2N/A AC_REQUIRE([AC_TYPE_LONG_LONG_INT])
2N/A AC_REQUIRE([gt_TYPE_WCHAR_T])
2N/A AC_REQUIRE([gt_TYPE_WINT_T])
2N/A AC_CHECK_FUNCS([snprintf strnlen wcslen wcsnlen mbrtowc wcrtomb])
2N/A dnl Use the _snprintf function only if it is declared (because on NetBSD it
2N/A dnl is defined as a weak alias of snprintf; we prefer to use the latter).
2N/A AC_CHECK_DECLS([_snprintf], , , [#include <stdio.h>])
2N/A dnl We can avoid a lot of code by assuming that snprintf's return value
2N/A dnl conforms to ISO C99. So check that.
2N/A AC_REQUIRE([gl_SNPRINTF_RETVAL_C99])
2N/A case "$gl_cv_func_snprintf_retval_c99" in
2N/A *yes)
2N/A AC_DEFINE([HAVE_SNPRINTF_RETVAL_C99], [1],
2N/A [Define if the return value of the snprintf function is the number of
2N/A of bytes (excluding the terminating NUL) that would have been produced
2N/A if the buffer had been large enough.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting 'long double'
2N/A# arguments.
2N/AAC_DEFUN_ONCE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_LONG_DOUBLE])
2N/A case "$gl_cv_func_printf_long_double" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A 'long double' arguments.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'double'
2N/A# arguments.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_INFINITE])
2N/A case "$gl_cv_func_printf_infinite" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_INFINITE_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A infinite 'double' arguments.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting infinite 'long double'
2N/A# arguments.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_INFINITE_LONG_DOUBLE])
2N/A dnl There is no need to set NEED_PRINTF_INFINITE_LONG_DOUBLE if
2N/A dnl NEED_PRINTF_LONG_DOUBLE is already set.
2N/A AC_REQUIRE([gl_PREREQ_VASNPRINTF_LONG_DOUBLE])
2N/A case "$gl_cv_func_printf_long_double" in
2N/A *yes)
2N/A case "$gl_cv_func_printf_infinite_long_double" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_INFINITE_LONG_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A infinite 'long double' arguments.])
2N/A ;;
2N/A esac
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the 'a' directive.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_A],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_DIRECTIVE_A])
2N/A case "$gl_cv_func_printf_directive_a" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_DIRECTIVE_A], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A the 'a' and 'A' directives.])
2N/A AC_CHECK_FUNCS([nl_langinfo])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the 'F' directive.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_F],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_DIRECTIVE_F])
2N/A case "$gl_cv_func_printf_directive_f" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_DIRECTIVE_F], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A the 'F' directive.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the 'ls' directive.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_DIRECTIVE_LS],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_DIRECTIVE_LS])
2N/A case "$gl_cv_func_printf_directive_ls" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_DIRECTIVE_LS], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A the 'ls' directive.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the ' flag.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_GROUPING],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_FLAG_GROUPING])
2N/A case "$gl_cv_func_printf_flag_grouping" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_FLAG_GROUPING], [1],
2N/A [Define if the vasnprintf implementation needs special code for the
2N/A ' flag.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the '-' flag.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_FLAG_LEFTADJUST])
2N/A case "$gl_cv_func_printf_flag_leftadjust" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_FLAG_LEFTADJUST], [1],
2N/A [Define if the vasnprintf implementation needs special code for the
2N/A '-' flag.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting the 0 flag.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_FLAG_ZERO],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_FLAG_ZERO])
2N/A case "$gl_cv_func_printf_flag_zero" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_FLAG_ZERO], [1],
2N/A [Define if the vasnprintf implementation needs special code for the
2N/A 0 flag.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for supporting large precisions.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_PRECISION],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_PRECISION])
2N/A case "$gl_cv_func_printf_precision" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_UNBOUNDED_PRECISION], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A supporting large precisions without arbitrary bounds.])
2N/A AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A 'double' arguments.])
2N/A AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A 'long double' arguments.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Extra prerequisites of lib/vasnprintf.c for surviving out-of-memory
2N/A# conditions.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_ENOMEM],
2N/A[
2N/A AC_REQUIRE([gl_PRINTF_ENOMEM])
2N/A case "$gl_cv_func_printf_enomem" in
2N/A *yes)
2N/A ;;
2N/A *)
2N/A AC_DEFINE([NEED_PRINTF_ENOMEM], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A surviving out-of-memory conditions.])
2N/A AC_DEFINE([NEED_PRINTF_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A 'double' arguments.])
2N/A AC_DEFINE([NEED_PRINTF_LONG_DOUBLE], [1],
2N/A [Define if the vasnprintf implementation needs special code for
2N/A 'long double' arguments.])
2N/A ;;
2N/A esac
2N/A])
2N/A
2N/A# Prerequisites of lib/vasnprintf.c including all extras for POSIX compliance.
2N/AAC_DEFUN([gl_PREREQ_VASNPRINTF_WITH_EXTRAS],
2N/A[
2N/A AC_REQUIRE([gl_PREREQ_VASNPRINTF])
2N/A gl_PREREQ_VASNPRINTF_LONG_DOUBLE
2N/A gl_PREREQ_VASNPRINTF_INFINITE_DOUBLE
2N/A gl_PREREQ_VASNPRINTF_INFINITE_LONG_DOUBLE
2N/A gl_PREREQ_VASNPRINTF_DIRECTIVE_A
2N/A gl_PREREQ_VASNPRINTF_DIRECTIVE_F
2N/A gl_PREREQ_VASNPRINTF_DIRECTIVE_LS
2N/A gl_PREREQ_VASNPRINTF_FLAG_GROUPING
2N/A gl_PREREQ_VASNPRINTF_FLAG_LEFTADJUST
2N/A gl_PREREQ_VASNPRINTF_FLAG_ZERO
2N/A gl_PREREQ_VASNPRINTF_PRECISION
2N/A gl_PREREQ_VASNPRINTF_ENOMEM
2N/A])
2N/A
2N/A# Prerequisites of lib/asnprintf.c.
2N/AAC_DEFUN([gl_PREREQ_ASNPRINTF],
2N/A[
2N/A])