File: AC_FUNC_SNPRINTF.m4

package info (click to toggle)
log4cpp 1.1.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,444 kB
  • sloc: cpp: 6,715; sh: 3,670; ansic: 1,049; makefile: 295
file content (22 lines) | stat: -rw-r--r-- 865 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
dnl @synopsis AC_FUNC_SNPRINTF
dnl
dnl Provides a test for a working snprintf function.
dnl unlike the original AC_FUNC_SNPRINTF test this one will also
dnl accept snprintf implementations which return -1 if the string does
dnl not fit in the buffer, e.g. snprintf on Solaris and glibc <= 2.0.6.
dnl defines HAVE_SNPRINTF if it is found, and
dnl sets ac_cv_func_snprintf to yes, otherwise to no.
dnl
dnl @version $Id$
dnl @author Caolan McNamara <caolan@skynet.ie>
dnl
AC_DEFUN([AC_FUNC_SNPRINTF],
[AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf,
[AC_TRY_RUN([#include <stdio.h>
int main () { int l = snprintf(NULL,0,"%d",100); return !((3 <= l) || (-1 == l)); }
], ac_cv_func_snprintf=yes, ac_cv_func_snprintf=no,
ac_cv_func_snprintf=no)])
if test $ac_cv_func_snprintf = yes; then
  AC_DEFINE(HAVE_SNPRINTF,,[define if the C library has snprintf])
fi
])