Macro: ac_func_snprintf

Back to the Main Page. | Download the M4 Source.

# ac_func_snprintf

## Synopsis

`AC_FUNC_SNPRINTF`

## Version

1.1.1.1 (2001/07/26) C_Support @ ac-archive-0.5.32

## Author

Caolan McNamara <caolan@skynet.ie>

## Description

Provides a test for a fully C9x complient snprintf function. defines HAVE_SNPRINTF if it is found, and sets ac_cv_func_snprintf to yes, otherwise to no.

## M4 Source Code

    AC_DEFUN([AC_FUNC_SNPRINTF],
    [AC_CACHE_CHECK(for working snprintf, ac_cv_func_snprintf,
    [AC_TRY_RUN([#include <stdio.h>
    int main () { exit (!(3 <= snprintf(NULL,0,"%d",100))); }
    ], 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)
    fi
    ])