vsnprintf.m4 revision 05436638acc7c010349a69c3395f1a57c642dc62
1# vsnprintf.m4 serial 6
2dnl Copyright (C) 2002-2004, 2007-2012 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
7dnl Libintl 0.17 will replace vsnprintf only if it does not support %1$s,
8dnl but defers to any gnulib vsnprintf replacements.  Therefore, gnulib
9dnl must guarantee that the decision for replacing vsnprintf is a superset
10dnl of the reasons checked by libintl.
11AC_DEFUN([gl_FUNC_VSNPRINTF],
12[
13  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
14  gl_cv_func_vsnprintf_usable=no
15  AC_CHECK_FUNCS([vsnprintf])
16  if test $ac_cv_func_vsnprintf = yes; then
17    gl_SNPRINTF_SIZE1
18    case "$gl_cv_func_snprintf_size1" in
19      *yes)
20        gl_SNPRINTF_RETVAL_C99
21        case "$gl_cv_func_snprintf_retval_c99" in
22          *yes)
23            gl_PRINTF_POSITIONS
24            case "$gl_cv_func_printf_positions" in
25              *yes)
26                gl_cv_func_vsnprintf_usable=yes
27                ;;
28            esac
29            ;;
30        esac
31        ;;
32    esac
33  fi
34  if test $gl_cv_func_vsnprintf_usable = no; then
35    gl_REPLACE_VSNPRINTF
36  fi
37  AC_CHECK_DECLS_ONCE([vsnprintf])
38  if test $ac_cv_have_decl_vsnprintf = no; then
39    HAVE_DECL_VSNPRINTF=0
40  fi
41])
42
43AC_DEFUN([gl_REPLACE_VSNPRINTF],
44[
45  AC_REQUIRE([gl_STDIO_H_DEFAULTS])
46  AC_LIBOBJ([vsnprintf])
47  if test $ac_cv_func_vsnprintf = yes; then
48    REPLACE_VSNPRINTF=1
49  fi
50  gl_PREREQ_VSNPRINTF
51])
52
53# Prerequisites of lib/vsnprintf.c.
54AC_DEFUN([gl_PREREQ_VSNPRINTF], [:])
55