AC_DEFUN(GST_C_VARARGS, [

AC_CHECK_HEADERS(stdarg.h)

AC_CACHE_CHECK(whether va_arg(..., char) works, gst_cv_working_va_arg, [
  AC_TRY_LINK([
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#else
# include <varargs.h>
#endif

#ifdef HAVE_STDARG_H
int testfunc (int test, ...)
#else
int testfunc (va_alist)
     va_dcl
#endif
{
  va_list	args;
  char          test2;
  
#ifdef HAVE_STDARG_H
  va_start(args, test);
#else
  int		test;
  
  va_start(args);
  test = va_arg(args, int);
#endif

  test = va_arg(args, char);
  
}], [
  testfunc(5, '3');
  return 0;
],
	      gst_cv_working_va_arg=yes,
	      gst_cv_working_va_arg=no)
])

test $gst_cv_working_va_arg = no && \
AC_DEFINE(PICKY_VA_ARG, 1, [Define if your system does not support va_arg(..., char)])

])dnl
