[Zlib-devel] Checking for availability of snprintf

Nelson H. F. Beebe beebe at math.utah.edu
Fri Mar 14 06:35:59 EST 2003


Cosmin Truta <cosmin at cs.toronto.edu> proposes configure.in code like
this to check for the availability of snprintf:

>> ...
>> /* vsnprintf setup */
>> #if !defined(STDC99) && !(defined(__TURBOC__) && __TURBOC__ >= 0x550)
>> #  ifdef MSDOS
>>      /* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
>>         but for now we just assume it doesn't. */
>> #    define NO_vsnprintf
>> #  endif
>> #  ifdef WIN32
>>      /* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
>> #    if !defined(vsnprintf) && !defined(__TURBOC__)
>> #      define vsnprintf _vsnprintf
>> #    endif
>> #  endif
>> #  ifdef __TURBOC__
>> #    define NO_vsnprintf
>> #  endif
>> #endif
>> ...

This is not the right way to use configure.  configure.in should
simply use the test macros to find out whether vsnprintf() is
available in the library, rather than trying to set it based on
compiler flags.  Newer releases of those compiler might provide the
missing feature, but those flags won't change.



More information about the Zlib-devel mailing list