ax_varargs.m4 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. dnl @synopsis AX_CPP_VARARG_MACRO_GCC
  2. dnl
  3. dnl Test if the preprocessor understands GNU GCC-style vararg macros.
  4. dnl If it does, defines HAVE_CPP_VARARG_MACRO_GCC to 1.
  5. dnl
  6. dnl @version
  7. dnl @author James Yonan <jim@yonan.net>, Matthias Andree <matthias.andree@web.de>
  8. AC_DEFUN([AX_CPP_VARARG_MACRO_GCC], [dnl
  9. AS_VAR_PUSHDEF([VAR], [ax_cv_cpp_vararg_macro_gcc])dnl
  10. AC_CACHE_CHECK(
  11. [for GNU GCC vararg macro support],
  12. [VAR],
  13. [AC_COMPILE_IFELSE(
  14. [AC_LANG_PROGRAM(
  15. [[
  16. #define macro(a, b...) func(a, b)
  17. int func(int a, int b, int c);
  18. ]],
  19. [[
  20. int i = macro(1, 2, 3);
  21. ]]
  22. )],
  23. [VAR=yes],
  24. [VAR=no]
  25. )]
  26. )dnl
  27. AS_VAR_IF(
  28. [VAR],
  29. [yes],
  30. [AC_DEFINE(
  31. [HAVE_CPP_VARARG_MACRO_GCC],
  32. [1],
  33. [Define to 1 if your compiler supports GNU GCC-style variadic macros]
  34. )]
  35. )dnl
  36. AS_VAR_POPDEF([VAR])dnl
  37. ])
  38. dnl @synopsis AX_CPP_VARARG_MACRO_ISO
  39. dnl
  40. dnl Test if the preprocessor understands ISO C 1999 vararg macros.
  41. dnl If it does, defines HAVE_CPP_VARARG_MACRO_ISO to 1.
  42. dnl
  43. dnl @version
  44. dnl @author James Yonan <jim@yonan.net>, Matthias Andree <matthias.andree@web.de>
  45. AC_DEFUN([AX_CPP_VARARG_MACRO_ISO], [dnl
  46. AS_VAR_PUSHDEF([VAR],[ax_cv_cpp_vararg_macro_iso])dnl
  47. AC_CACHE_CHECK(
  48. [for ISO C 1999 vararg macro support],
  49. [VAR],
  50. [AC_COMPILE_IFELSE(
  51. [AC_LANG_PROGRAM(
  52. [[
  53. #define macro(a, ...) func(a, __VA_ARGS__)
  54. int func(int a, int b, int c);
  55. ]],
  56. [[
  57. int i = macro(1, 2, 3);
  58. ]]
  59. )],
  60. [VAR=yes],
  61. [VAR=no]
  62. )]
  63. )dnl
  64. AS_VAR_IF(
  65. [VAR],
  66. [yes],
  67. [AC_DEFINE(
  68. [HAVE_CPP_VARARG_MACRO_ISO],
  69. [1],
  70. [Define to 1 if your compiler supports ISO C99 variadic macros]
  71. )]
  72. )dnl
  73. AS_VAR_POPDEF([VAR])dnl
  74. ])