X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=configure.ad;h=3244e3786b8962bd6746ab7decd1bf3cb4f40f36;hp=a4a9d403a8fa4b33f6260f2a4a1889b2886a4149;hb=e0bbbcc41edc732a66c55d26a56002f907fdaaf4;hpb=411c45bfd3b792e33a2abe440283c53b26a30a28 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 ##