1# stdarg.m4 serial 1 2dnl Copyright (C) 2006 Free Software Foundation, Inc. 3dnl This file is free software; the Free Software Foundation 4dnl gives unlimited permission to copy and/or distribute it, 5dnl with or without modifications, as long as this notice is preserved. 6 7dnl From Bruno Haible. 8dnl Provide a working va_copy in combination with <stdarg.h>. 9 10AC_DEFUN([gl_STDARG_H], 11[ 12 AC_MSG_CHECKING([for va_copy]) 13 AC_CACHE_VAL([gl_cv_func_va_copy], [ 14 AC_TRY_COMPILE([#include <stdarg.h>], [ 15#ifndef va_copy 16void (*func) (va_list, va_list) = va_copy; 17#endif 18], 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>], [ 25#ifndef __va_copy 26error, bail out 27#endif 28], 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.]) 33 else 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.]) 38 fi 39 fi 40]) 41