[Zlib-devel] Checking for availability of snprintf

Greg Roelofs newt at pobox.com
Fri Mar 14 09:58:01 EST 2003


"Nelson H. F. Beebe" <beebe at math.utah.edu> wrote:

> 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
 [...]

Of course, Messrs. Truta and Beebe are no doubt both fully aware that
configure doesn't run in a DOS box, so such code would still be still
required in zconf.h or wherever...

Greg




More information about the Zlib-devel mailing list