bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: check for C99-compliant snprintf


From: Albert Chin
Subject: Re: check for C99-compliant snprintf
Date: Mon, 19 Feb 2007 17:25:18 -0600
User-agent: Mutt/1.5.6i

On Fri, Feb 16, 2007 at 04:57:15PM -0800, Ben Pfaff wrote:
> RCS file: /sources/gnulib/gnulib/m4/vsnprintf.m4,v
> retrieving revision 1.2
> diff -u -p -r1.2 vsnprintf.m4
> --- m4/vsnprintf.m4   23 Jan 2005 08:06:57 -0000      1.2
> +++ m4/vsnprintf.m4   17 Feb 2007 00:56:09 -0000
> @@ -1,12 +1,27 @@
> -# vsnprintf.m4 serial 2
> -dnl Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
> +# vsnprintf.m4 serial 3
> +dnl Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
>  dnl This file is free software; the Free Software Foundation
>  dnl gives unlimited permission to copy and/or distribute it,
>  dnl with or without modifications, as long as this notice is preserved.
>  
>  AC_DEFUN([gl_FUNC_VSNPRINTF],
>  [
> -  AC_REPLACE_FUNCS(vsnprintf)
> +  AC_REQUIRE([gl_AC_NATIVE_W32])
> +  AC_CHECK_FUNCS_ONCE(vsnprintf)
> +  AC_MSG_CHECKING([for C99-compliant vsnprintf])
> +  if test $ac_cv_func_vsnprintf = no || test $gl_cv_native_w32 = yes; then
> +    AC_LIBOBJ(vsnprintf)
> +    AC_DEFINE(vsnprintf, rpl_vsnprintf,
> +      [Define to rpl_vsnprintf if the replacement function should be used.])
> +    AC_MSG_RESULT([no])
> +  else
> +    AC_MSG_RESULT([yes])
> +  fi
> +  if test $gl_cv_native_w32 = yes; then
> +    AC_LIBOBJ(_vsnprintf)
> +    AC_DEFINE(_vsnprintf, rpl__vsnprintf,
> +      [Define to rpl__vsnprintf if the replacement function should be used.])
> +  fi
>    AC_CHECK_DECLS_ONCE(vsnprintf)
>    gl_PREREQ_VSNPRINTF
>  ])

Huh? So, if vsnprintf() exists, you assume it's C99-compliant? glib
has a check for this, AC_FUNC_VSNPRINTF_C99, because that's not the
case on some systems. And, we found that Solaris and AIX 5.1 do not
have a C99-compliant vsnprintf(). The attached program returns -1 on
Solaris 6/SPARC thru Solaris 9/SPARC which has vsnprintf(), for
example.

-- 
albert chin (address@hidden)

Attachment: vc.c
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]