1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
dnl ***
dnl *** C99 vsnprintf()?
dnl ***
AC_DEFUN([DOVECOT_C99_VSNPRINTF], [
AC_CACHE_CHECK([for C99 vsnprintf()],i_cv_c99_vsnprintf,[
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <stdio.h>
#include <stdarg.h>
static int f(const char *fmt, ...) {
va_list args;
char buf[13];
int ret;
va_start(args, fmt);
ret = vsnprintf(buf, 11, fmt, args) != 12 || buf[11-1] != '\0';
va_end(args);
return ret;
}
int main() {
return f("hello %s%d", "world", 1);
}]])],
[i_cv_c99_vsnprintf=yes],
[i_cv_c99_vsnprintf=no])
])
if test $i_cv_c99_vsnprintf = no; then
AC_DEFINE(HAVE_OLD_VSNPRINTF,, [Define if you don't have C99 compatible vsnprintf() call])
fi
])
|