acinclude.m4 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. dnl -*- mode: autoconf -*-
  2. dnl [m4_newline] didn't appear until autoconf 2.62
  3. m4_ifdef([m4_newline],,[m4_define([m4_newline],[
  4. ])])
  5. dnl These are not available in autoconf 2.59
  6. m4_ifdef([m4_foreach_w],,[m4_define([m4_foreach_w],
  7. [m4_foreach([$1], m4_split(m4_normalize([$2]), [ ]), [$3])])])
  8. m4_ifdef([AS_CASE],,[
  9. m4_define([_AS_CASE],
  10. [m4_if([$#], 0, [m4_fatal([$0: too few arguments: $#])],
  11. [$#], 1, [ *) $1 ;;],
  12. [$#], 2, [ $1) m4_default([$2], [:]) ;;],
  13. [ $1) m4_default([$2], [:]) ;;
  14. $0(m4_shift2($@))])dnl
  15. ])
  16. m4_defun([AS_CASE],
  17. [m4_ifval([$2$3],
  18. [case $1 in
  19. _AS_CASE(m4_shift($@))
  20. esac
  21. ])dnl
  22. ])# AS_CASE
  23. ])
  24. m4_ifdef([m4_shift2],, [m4_define([m4_shift2], [m4_shift(m4_shift($@))])])
  25. dnl ==========================================================================
  26. dnl This has to be in acinclude.m4 as it includes other files
  27. dnl Parse Version.mk and declare m4 variables out of it
  28. m4_define([CAIRO_PARSE_VERSION],dnl
  29. m4_translit(dnl
  30. m4_bpatsubst(m4_include(cairo-version.h),
  31. [^.define \([a-zA-Z0-9_]*\) *\([0-9][0-9]*\)],
  32. [[m4_define(\1, \2)]]),
  33. [A-Z], [a-z])dnl
  34. )dnl
  35. dnl ==========================================================================
  36. m4_pattern_forbid([^cr_])
  37. dnl AC_AUTOCONF_VERSION was introduced in 2.62, so its definition works as
  38. dnl a conditional on version >= 2.62. Older versions did not call
  39. dnl m4_pattern_allow from AC_DEFINE and friends. To avoid lots of warnings we
  40. dnl only forbid CAIRO_ if autoconf is recent enough.
  41. m4_ifdef([AC_AUTOCONF_VERSION],
  42. [m4_pattern_forbid([CAIRO])],
  43. [m4_pattern_forbid([_CAIRO])])