2 dnl Copyright (C) 2006 Free Software Foundation, Inc.
3 dnl This file is free software; the Free Software Foundation
4 dnl gives unlimited permission to copy and/or distribute it,
5 dnl with or without modifications, as long as this notice is preserved.
8 dnl Provide a working va_copy in combination with <stdarg.h>.
10 AC_DEFUN([gl_STDARG_H],
12 AC_MSG_CHECKING([for va_copy])
13 AC_CACHE_VAL([gl_cv_func_va_copy], [
14 AC_TRY_COMPILE([#include <stdarg.h>], [
16 void (*func) (va_list, va_list) = va_copy;
19 [gl_cv_func_va_copy=yes], [gl_cv_func_va_copy=no])])
20 AC_MSG_RESULT([$gl_cv_func_va_copy])
21 if test $gl_cv_func_va_copy = no; then
22 # Provide a substitute, either __va_copy or as a simple assignment.
23 AC_CACHE_VAL([gl_cv_func___va_copy], [
24 AC_TRY_COMPILE([#include <stdarg.h>], [
29 [gl_cv_func___va_copy=yes], [gl_cv_func___va_copy=no])])
30 if test $gl_cv_func___va_copy = yes; then
31 AC_DEFINE([va_copy], [__va_copy],
32 [Define as a macro for copying va_list variables.])
34 AH_VERBATIM([gl_VA_COPY], [/* A replacement for va_copy, if needed. */
35 #define gl_va_copy(a,b) ((a) = (b))])
36 AC_DEFINE([va_copy], [gl_va_copy],
37 [Define as a macro for copying va_list variables.])