added tests for va_copy and va_list

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29605 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2004-10-02 18:33:34 +00:00
parent d85cfb3784
commit 8fa53e0eee
3 changed files with 79 additions and 0 deletions

View File

@ -1713,6 +1713,65 @@ AC_CACHE_CHECK([size of wchar_t], wx_cv_sizeof_wchar_t,
AC_DEFINE_UNQUOTED(SIZEOF_WCHAR_T, $wx_cv_sizeof_wchar_t)
dnl checks needed to define wxVaCopy
AC_CACHE_CHECK([for va_copy],
wx_cv_func_va_copy,
[
AC_COMPILE_IFELSE([
#include <stdarg.h>
void foo(char *f, ...)
{
va_list ap1, ap2;
va_start(ap1, f);
va_copy(ap2, ap1);
va_end(ap2);
va_end(ap1);
}],
wx_cv_func_va_copy=yes,
wx_cv_func_va_copy=no
)
]
)
if test $wx_cv_func_va_copy = "yes"; then
AC_DEFINE(HAVE_VA_COPY)
else
dnl try to understand how can we copy va_lists
AC_CACHE_CHECK([if va_list can be copied by value],
wx_cv_type_va_list_lvalue,
[
AC_RUN_IFELSE([
#include <stdarg.h>
int foo(char *f, ...)
{
va_list ap1, ap2;
va_start(ap1, f);
ap2 = ap1;
if ( va_arg(ap1, int) != 17 || va_arg(ap2, int) != 17 )
return 1;
va_end(ap2);
va_end(ap1);
return 0;
}
int main()
{
return foo("hi", 17);
}],
wx_cv_type_va_list_lvalue=yes,
wx_cv_type_va_list_lvalue=no,
dnl assume most common case for cross-compiling...
wx_cv_type_va_list_lvalue=yes
)
]
)
if test $wx_cv_type_va_list_lvalue != "yes"; then
dnl we suppose that the only thing which can't be copied like this
dnl are arrays... only experience will show whether this is really true
AC_DEFINE(VA_LIST_IS_ARRAY)
fi
fi
dnl check for large file support
AC_SYS_LARGEFILE

View File

@ -173,6 +173,16 @@
*/
#undef HAVE_STATIC_CAST
/*
* Define if your compiler has C99 va_copy
*/
#undef HAVE_VA_COPY
/*
* Define if va_list type is an array
*/
#undef VA_LIST_IS_ARRAY
/*
* Define if your compiler has std::wstring
*/

View File

@ -182,6 +182,16 @@
*/
#define HAVE_STATIC_CAST 1
/*
* Define if your compiler has C99 va_copy
*/
#undef HAVE_VA_COPY
/*
* Define if va_list type is an array
*/
#undef VA_LIST_IS_ARRAY
/*
* Define if your compiler has std::wstring
*/