From: Pekka Riikonen Date: Thu, 30 Nov 2006 14:55:02 +0000 (+0000) Subject: va_copy checks. X-Git-Tag: silc.client.1.1.beta1~156 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=e0bbbcc41edc732a66c55d26a56002f907fdaaf4 va_copy checks. --- diff --git a/configure.ad b/configure.ad index a4a9d403..3244e378 100644 --- a/configure.ad +++ b/configure.ad @@ -296,6 +296,109 @@ AC_ARG_ENABLE(asm, want_asm=true ]) +## +## va_copy checks +## +va_copy=false +AC_MSG_CHECKING(for va_copy) +AC_TRY_COMPILE( + [ + #include + #include + ], + [ + int t(int x, ...) + { + va_list va, cp; + va_start(va, x); + va_copy(cp, va); + if (va_arg(cp, int) != 0xff11) + return 1; + va_end(va); + va_end(cp); + return 0; + } + int main() + { + return t(0, 0xff11); + } + ], + [ + AC_DEFINE([HAVE_VA_COPY], [], [HAVE_VA_COPY]) + AC_MSG_RESULT(yes) + va_copy=true + ], + [ + AC_MSG_RESULT(no) + va_copy=false + ] +) + +if test x$va_copy = xfalse; then + AC_MSG_CHECKING(for __va_copy) + AC_TRY_COMPILE( + [ + #include + #include + ], + [ + int t(int x, ...) + { + va_list va, cp; + va_start(va, x); + __va_copy(cp, va); + if (va_arg(cp, int) != 0xff11) + return 1; + va_end(va); + va_end(cp); + return 0; + } + int main() + { + return t(0, 0xff11); + } + ], + [ + AC_DEFINE([HAVE___VA_COPY], [], [HAVE___VA_COPY]) + AC_MSG_RESULT(yes) + va_copy=true + ], + [ + AC_MSG_RESULT(no) + va_copy=false + ] + ) +fi + +if test x$va_copy = xfalse; then + AC_RUN_IFELSE( + [ + #include + #include + int t(int x, ...) + { + va_list va, cp; + va_start(va, x); + cp = va; + if (va_arg(cp, int) != 0xff11) + return 1; + va_end(va); + va_end(cp); + return 0; + } + int main() + { + return t(0, 0xff11); + } + ], + [va_copy=false], + [ + AC_DEFINE([SILC_VA_COPY_ARRAY], [], [SILC_VA_COPY_ARRAY]) + ], + [va=copy=false] + ) +fi + ## ## Compiler and compiler flag checks ##