File: AC_FUNC_SNPRINTF.m4

package info (click to toggle)
log4shib 2.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,968 kB
  • sloc: cpp: 4,786; sh: 4,242; ansic: 818; makefile: 193
file content (22 lines) | stat: -rw-r--r-- 926 bytes parent folder | download | duplicates (12)
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: AC_FUNC_SNPRINTF.m4,v 1.2 2001/09/18 15:42:29 bastiaan Exp $
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); exit (!((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
])