1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/tool/m4/ruby_check_va_copy.m4
nobu 2b1ba32514 ruby_check_va_copy.m4: for cross compiling
* tool/m4/ruby_check_va_copy.m4 (RUBY_CHECK_VA_COPY): use
  AC_TRY_LINK instead of AC_TRY_RUN for cross compiling.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16 14:35:06 +00:00

30 lines
703 B
Text

# -*- Autoconf -*-
AC_DEFUN([RUBY_CHECK_VA_COPY], [
AS_IF([test "x$rb_cv_va_copy" = x], [dnl
AC_TRY_LINK(
[@%:@include <stdlib.h>
@%:@include <stdarg.h>
@%:@include <string.h>
@%:@define CONFTEST_VA_COPY(dst, src) $2
void
conftest(int n, ...)
{
va_list ap, ap2;
int i;
va_start(ap, n);
CONFTEST_VA_COPY(ap2, ap);
for (i = 0; i < n; i++) if ((int)va_arg(ap, int) != n - i - 1) abort();
va_end(ap);
CONFTEST_VA_COPY(ap, ap2);
for (i = 0; i < n; i++) if ((int)va_arg(ap, int) != n - i - 1) abort();
va_end(ap);
va_end(ap2);
}],
[
conftest(10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0);
],
[rb_cv_va_copy="$1"],
[rb_cv_va_copy=""])dnl
])dnl
])dnl
dnl