[Mesa-dev] [PATCH] configure.ac: add and use AC_PROG_BISON/FLEX macros

Matt Turner mattst88 at gmail.com
Tue Jan 10 22:29:22 PST 2012


On Wed, Jan 11, 2012 at 1:16 AM, Matt Turner <mattst88 at gmail.com> wrote:
> Defining these macros lets us use AC_PROG_YACC/LEX which makes automake
> easier while still specifically requiring bison and flex.
>
> Based on bison.m4 and flex.m4 found in LLVM's tree.
>
> Signed-off-by: Matt Turner <mattst88 at gmail.com>
> ---
>  configure.ac |    9 ++++-----
>  m4/bison.m4  |   16 ++++++++++++++++
>  m4/flex.m4   |   16 ++++++++++++++++
>  3 files changed, 36 insertions(+), 5 deletions(-)
>  create mode 100644 m4/bison.m4
>  create mode 100644 m4/flex.m4
>
> diff --git a/configure.ac b/configure.ac
> index 511d147..c0abeb9 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -45,11 +45,10 @@ if test "x$MKDEP" = "x"; then
>     AC_MSG_ERROR([makedepend is required to build Mesa])
>  fi
>
> -AC_PATH_PROG([FLEX], [flex])
> -test "x$FLEX" = "x" && AC_MSG_ERROR([flex is needed to build Mesa])
> -
> -AC_PATH_PROG([BISON], [bison])
> -test "x$BISON" = "x" && AC_MSG_ERROR([bison is needed to build Mesa])
> +m4_include([m4/bison.m4])
> +AC_PROG_BISON
> +m4_include([m4/flex.m4])
> +AC_PROG_FLEX
>
>  dnl Our fallback install-sh is a symlink to minstall. Use the existing
>  dnl configuration in that case.
> diff --git a/m4/bison.m4 b/m4/bison.m4
> new file mode 100644
> index 0000000..641d438
> --- /dev/null
> +++ b/m4/bison.m4
> @@ -0,0 +1,16 @@
> +#
> +# Check for Bison.
> +#
> +# This macro verifies that Bison is installed.  If successful, then
> +# 1) YACC is set to bison -y (to emulate YACC calls)
> +# 2) BISON is set to bison
> +#
> +AC_DEFUN([AC_PROG_BISON],
> +[AC_PROG_YACC()
> +if test "$YACC" != "bison -y"; then
> +  AC_SUBST(BISON,[])
> +  AC_MSG_WARN([bison not found])

This should be AC_MSG_ERROR.

> +else
> +  AC_SUBST(BISON,[bison])
> +fi
> +])
> diff --git a/m4/flex.m4 b/m4/flex.m4
> new file mode 100644
> index 0000000..6a2a004
> --- /dev/null
> +++ b/m4/flex.m4
> @@ -0,0 +1,16 @@
> +#
> +# Check for FLEX.
> +#
> +# This macro verifies that flex is installed.  If successful, then
> +# 1) LEX is set to flex (to emulate lex calls)
> +# 2) FLEX is set to flex
> +#
> +AC_DEFUN([AC_PROG_FLEX],
> +[AC_PROG_LEX()
> +if test "$LEX" != "flex"; then
> +  AC_SUBST(FLEX,[])
> +  AC_MSG_ERROR([flex not found])
> +else
> +  AC_SUBST(FLEX,[flex])
> +fi
> +])
> --
> 1.7.3.4
>


More information about the mesa-dev mailing list