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