PageRenderTime 30ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/m4/ragel.m4

http://github.com/mozy/mordor
m4 | 53 lines | 46 code | 7 blank | 0 comment | 0 complexity | 1d6544f12a98fe41d1965874b7192413 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. dnl Check for presence of the Ragel State Machine generator.
  2. dnl
  3. dnl This macro checks for the presence of the ragel tool in the system,
  4. dnl and whether the ragel tool is absolutely needed for a complete
  5. dnl build.
  6. dnl
  7. dnl To check for the need for Ragel, you have to provide the relative
  8. dnl path of a source file generated through Ragel: if the file is
  9. dnl present in the source tree, a missing ragel command will not cause
  10. dnl the configure to abort.
  11. AC_DEFUN([_RAGEL_VARS], [
  12. AC_ARG_VAR([RAGEL], [Ragel generator command])
  13. AC_ARG_VAR([RAGELFLAGS], [Ragel generator flags])
  14. ])
  15. AC_DEFUN([CHECK_RAGEL], [
  16. AC_REQUIRE([_RAGEL_VARS])
  17. AC_PATH_PROG([RAGEL], [ragel], [no], [$PATH:/usr/local/bin:/opt/local/bin])
  18. dnl We set RAGEL to false so that it would execute the "false"
  19. dnl command if needed.
  20. AS_IF([test x"$RAGEL" = x"no"],
  21. [RAGEL=false],
  22. AS_IF([test x"$2" != "x"],
  23. [ragel_version=`$RAGEL --version | sed -n -e '1s:.*version \(@<:@0-9@:>@\.@<:@0-9@:>@\) .*:\1:p'`
  24. ragel_version_compare=`echo $ragel_version | tr -d .`
  25. ragel_wanted_version=`echo $2 | tr -d .`
  26. AS_IF([test $ragel_version_compare -lt $ragel_wanted_version],
  27. [AC_MSG_WARN([Found Ragel $ragel_version but Ragel $2 requested])
  28. RAGEL=false
  29. ])
  30. ]))
  31. dnl Only test the need if not found
  32. AS_IF([test x"$RAGEL" = x"false"], [
  33. AC_MSG_CHECKING([whether we need ragel to regenerate sources])
  34. AS_IF([test -a "${srcdir}/$1"], [ragel_needed=no], [ragel_needed=yes])
  35. AC_MSG_RESULT([$ragel_needed])
  36. AS_IF([test x"$ragel_needed" = x"yes"],
  37. [AC_MSG_ERROR([dnl
  38. You need Ragel to build from development sources.
  39. You can find Ragel at http://www.complang.org/ragel/dnl
  40. ])])
  41. ])
  42. ])
  43. AC_DEFUN([CHECK_RAGEL_AM], [
  44. CHECK_RAGEL([$1], [$2])
  45. AM_CONDITIONAL([HAVE_RAGEL], [test x"$RAGEL" != x"false"])
  46. ])