1 dnl $Heimdal: broken-snprintf.m4 15455 2005-06-16 21:03:43Z lha $
4 AC_DEFUN([AC_BROKEN_SNPRINTF], [
5 AC_CACHE_CHECK(for working snprintf,ac_cv_func_snprintf_working,
6 ac_cv_func_snprintf_working=yes
7 AC_RUN_IFELSE([AC_LANG_SOURCE([[
10 int main(int argc, char **argv)
13 snprintf(foo, 2, "12");
14 return strcmp(foo, "1") || snprintf(NULL, 0, "%d", 12) != 2;
15 }]])],[:],[ac_cv_func_snprintf_working=no],[:]))
17 if test "$ac_cv_func_snprintf_working" = yes; then
18 AC_DEFINE_UNQUOTED(HAVE_SNPRINTF, 1, [define if you have a working snprintf])
20 if test "$ac_cv_func_snprintf_working" = yes; then
21 AC_NEED_PROTO([#include <stdio.h>],snprintf)
25 AC_DEFUN([AC_BROKEN_VSNPRINTF],[
26 AC_CACHE_CHECK(for working vsnprintf,ac_cv_func_vsnprintf_working,
27 ac_cv_func_vsnprintf_working=yes
28 AC_RUN_IFELSE([AC_LANG_SOURCE([[
38 vsnprintf(bar, 2, "%s", arg);
40 return strcmp(bar, "1");
43 int bar(int num, int len, ...)
48 r = vsnprintf(NULL, 0, "%s", arg);
53 int main(int argc, char **argv)
55 return foo(0, "12") || bar(0, 2, "12");
56 }]])],[:],[ac_cv_func_vsnprintf_working=no],[:]))
58 if test "$ac_cv_func_vsnprintf_working" = yes; then
59 AC_DEFINE_UNQUOTED(HAVE_VSNPRINTF, 1, [define if you have a working vsnprintf])
61 if test "$ac_cv_func_vsnprintf_working" = yes; then
62 AC_NEED_PROTO([#include <stdio.h>],vsnprintf)