diff configure.in @ 5681:09415e6a0892 HEAD

Require C99 compatible vsnprintf(). Removed printf_string_upper_bound() and replaced the code with printf_format_fix*() and vsnprintf().
author Timo Sirainen <tss@iki.fi>
date Mon, 11 Jun 2007 02:21:30 +0300
parents fbb4bdbbf374
children c1f51c3510ca
line wrap: on
line diff
--- a/configure.in	Mon Jun 11 02:16:59 2007 +0300
+++ b/configure.in	Mon Jun 11 02:21:30 2007 +0300
@@ -433,7 +433,7 @@
 
 dnl * after -lsocket and -lnsl tests, inet_aton() may be in them
 AC_CHECK_FUNCS(fcntl flock lockf inet_aton sigaction getpagesize madvise \
-               strcasecmp stricmp vsnprintf vsyslog writev pread \
+               strcasecmp stricmp vsyslog writev pread \
 	       setrlimit setproctitle seteuid setreuid setegid setresgid \
 	       strtoull strtouq setpriority quotactl getmntent kqueue kevent \
 	       getrusage backtrace_symbols walkcontext dirfd \
@@ -1311,6 +1311,35 @@
 ])
 
 dnl ***
+dnl *** C99 vsnprintf()?
+dnl ***
+
+AC_CACHE_CHECK([for C99 vsnprintf()],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);
+  }]])],
+  [c99_vsnprintf=yes],
+  [c99_vsnprintf=no],
+  [])
+])
+if test $c99_vsnprintf = no; then
+  AC_ERROR([You don't appear to have C99 compatible vsnprintf() call])
+fi
+
+dnl ***
 dnl *** va_copy checks (from GLIB)
 dnl ***