3 AC_DEFUN([AC_BROKEN_SNPRINTF], [
4 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
5 ac_cv_func_snprintf_working=yes
6 AC_RUN_IFELSE([AC_LANG_SOURCE([[
9 int main(int argc, char **argv)
12 snprintf(foo, 2, "12");
13 return strcmp(foo, "1") || snprintf(NULL, 0, "%d", 12) != 2;
14 }]])],[:],[ac_cv_func_snprintf_working=no],[:]))
16 if test "$ac_cv_func_snprintf_working" = yes; then
17 AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
19 if test "$ac_cv_func_snprintf_working" = yes; then
20 AC_NEED_PROTO([#include <stdio.h>],snprintf)
24 AC_DEFUN([AC_BROKEN_VSNPRINTF],[
25 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
26 ac_cv_func_vsnprintf_working=yes
27 AC_RUN_IFELSE([AC_LANG_SOURCE([[
37 vsnprintf(bar, 2, "%s", arg);
39 return strcmp(bar, "1");
42 int bar(int num, int len, ...)
47 r = vsnprintf(NULL, 0, "%s", arg);
52 int main(int argc, char **argv)
54 return foo(0, "12") || bar(0, 2, "12");
55 }]])],[:],[ac_cv_func_vsnprintf_working=no],[:]))
57 if test "$ac_cv_func_vsnprintf_working" = yes; then
58 AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
60 if test "$ac_cv_func_vsnprintf_working" = yes; then
61 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)