diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 09:51:24 +0000 |
commit | f7548d6d28c313cf80e6f3ef89aed16a19815df1 (patch) | |
tree | a3f6f2a3f247293bee59ecd28e8cd8ceb6ca064a /m4/c99_vsnprintf.m4 | |
parent | Initial commit. (diff) | |
download | dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.tar.xz dovecot-f7548d6d28c313cf80e6f3ef89aed16a19815df1.zip |
Adding upstream version 1:2.3.19.1+dfsg1.upstream/1%2.3.19.1+dfsg1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'm4/c99_vsnprintf.m4')
-rw-r--r-- | m4/c99_vsnprintf.m4 | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/m4/c99_vsnprintf.m4 b/m4/c99_vsnprintf.m4 new file mode 100644 index 0000000..e642083 --- /dev/null +++ b/m4/c99_vsnprintf.m4 @@ -0,0 +1,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 +]) |