1dnl @synopsis GP_VA_COPY 2dnl 3dnl Checks whether one of these compiles and links: 4dnl 1. va_copy() 5dnl 2. __va_copy() 6dnl 3. fallback 7dnl 8dnl In case of 1 or 2, AC_DEFINE(HAVE_VA_COPY). 9dnl In case of 2, AC_DEFINE(va_copy,__va_copy) 10dnl 11dnl In code, use it like this 12dnl #ifdef HAVE_VA_COPY 13dnl ... code with va_copy ... 14dnl #else 15dnl ... code without va_copy or with error ... 16dnl #endif 17dnl 18AC_DEFUN([GP_VA_COPY],[dnl 19dnl 20AC_CHECK_HEADER([stdarg.h],[],[ 21 AC_MSG_ERROR([ 22Building $PACKAGE_NAME requires <stdarg.h>. 23]) 24]) 25dnl 26have_va_copy=no 27AC_TRY_LINK([ 28 #include <stdarg.h> 29],[ 30 va_list a,b; 31 va_copy(a,b); 32],[ 33 have_va_copy="va_copy" 34],[ 35 AC_TRY_LINK([ 36 #include <stdarg.h> 37 ],[ 38 va_list a,b; 39 __va_copy(a,b); 40 ],[ 41 have_va_copy="__va_copy" 42 AC_DEFINE([va_copy],[__va_copy],[__va_copy() was the originally proposed name]) 43 ]) 44]) 45dnl 46AC_MSG_CHECKING([for va_copy() or replacement]) 47AC_MSG_RESULT([$have_va_copy]) 48dnl 49if test "x$have_va_copy" != "xno"; then 50 AC_DEFINE([HAVE_VA_COPY],1,[Whether we have the va_copy() function]) 51fi 52])dnl 53dnl 54dnl 55dnl Local Variables: 56dnl mode: autoconf 57dnl End: 58