1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-28 17:32:29 +01:00

fixed configure check for c99 vsnprintf

This commit is contained in:
dan
2001-09-10 22:15:05 +00:00
parent 1cd42480bf
commit aae7c8b73a
3 changed files with 30 additions and 1 deletions

View File

@@ -89,3 +89,6 @@
/* define if you want Hermes support */ /* define if you want Hermes support */
#undef HAVE_HERMES #undef HAVE_HERMES
/* define if you have vsnprintf with C99 semantics */
#undef HAVE_C99_VSNPRINTF

View File

@@ -103,6 +103,32 @@ AC_FUNC_ALLOCA
AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp setpgid atexit mallinfo snprintf vsnprintf asprintf vasprintf mkstemp) AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp setpgid atexit mallinfo snprintf vsnprintf asprintf vasprintf mkstemp)
dnl ripped from samba
dnl
AC_CACHE_CHECK([for C99 vsnprintf],_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([
#include <sys/types.h>
#include <stdarg.h>
void foo(const char *format, ...) {
va_list ap;
int len;
char buf[5];
va_start(ap, format);
len = vsnprintf(0, 0, format, ap);
va_end(ap);
if (len != 5) exit(1);
if (snprintf(buf, 3, "hello") != 5 || strcmp(buf, "he") != 0) exit(1);
exit(0);
}
main() { foo("hello"); }
],
_cv_HAVE_C99_VSNPRINTF=yes,_cv_HAVE_C99_VSNPRINTF=no,_cv_HAVE_C99_VSNPRINTF=cross)])
if test x"$_cv_HAVE_C99_VSNPRINTF" = x"yes"; then
AC_DEFINE(HAVE_C99_VSNPRINTF)
fi
dnl Loading of dynamic libraries at runtime dnl Loading of dynamic libraries at runtime
dnl ======================================= dnl =======================================

View File

@@ -105,7 +105,7 @@ AC_CHECK_FUNCS(gethostname select poll strerror strcasecmp strncasecmp setpgid a
dnl ripped from samba dnl ripped from samba
dnl dnl
C_CACHE_CHECK([for C99 vsnprintf],_cv_HAVE_C99_VSNPRINTF,[ AC_CACHE_CHECK([for C99 vsnprintf],_cv_HAVE_C99_VSNPRINTF,[
AC_TRY_RUN([ AC_TRY_RUN([
#include <sys/types.h> #include <sys/types.h>
#include <stdarg.h> #include <stdarg.h>