[lttng-dev] [PATCH lttng-tools 2/2] Build: add Flex version check

Jérémie Galarneau jeremie.galarneau at efficios.com
Mon Jul 13 10:55:57 EDT 2015


Merged in master, stable-2.6 and stable-2.5.

Thanks!
Jérémie

On Fri, Jul 10, 2015 at 5:03 PM, Jonathan Rajotte <
jonathan.rajotte-julien at efficios.com> wrote:

> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  config/ax_prog_flex_version.m4 | 69
> ++++++++++++++++++++++++++++++++++++++++++
>  configure.ac                   |  4 +++
>  2 files changed, 73 insertions(+)
>  create mode 100644 config/ax_prog_flex_version.m4
>
> diff --git a/config/ax_prog_flex_version.m4
> b/config/ax_prog_flex_version.m4
> new file mode 100644
> index 0000000..da60e00
> --- /dev/null
> +++ b/config/ax_prog_flex_version.m4
> @@ -0,0 +1,69 @@
> +#
> ===========================================================================
> +#
> http://www.gnu.org/software/autoconf-archive/ax_prog_flex_version.html
> +#
> ===========================================================================
> +#
> +# SYNOPSIS
> +#
> +#   AX_PROG_FLEX_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
> +#
> +# DESCRIPTION
> +#
> +#   Makes sure that flex version is greater or equal to the version
> +#   indicated. If true the shell commands in ACTION-IF-TRUE are executed.
> If
> +#   not the shell commands in commands in ACTION-IF-TRUE are executed. If
> +#   not the shell commands in ACTION-IF-FALSE are run. Note if $FLEX is
> not
> +#   set (for example by running AC_CHECK_PROG or AC_PATH_PROG) the macro
> +#   will fail.
> +#
> +#   Example:
> +#
> +#     AC_PATH_PROG([FLEX],[flex])
> +#     AX_PROG_FLEX_VERSION([2.5.39],[ ... ],[ ... ])
> +#
> +#   This will check to make sure that the flex you have is at least
> version
> +#   2.5.39 or greater.
> +#
> +#   NOTE: This macro uses the $FLEX variable to perform the check.
> +#
> +# LICENSE
> +#
> +#   Copyright (c) 2015 Jonathan Rajotte-Julien <
> jonathan.rajotte-julien at efficios.com>
> +#
> +#   Copying and distribution of this file, with or without modification,
> are
> +#   permitted in any medium without royalty provided the copyright notice
> +#   and this notice are preserved. This file is offered as-is, without any
> +#   warranty.
> +
> +#serial 1
> +
> +AC_DEFUN([AX_PROG_FLEX_VERSION],[
> +    AC_REQUIRE([AC_PROG_SED])
> +    AC_REQUIRE([AC_PROG_GREP])
> +
> +    AS_IF([test -n "$FLEX"],[
> +        ax_flex_version="$1"
> +
> +        AC_MSG_CHECKING([for flex version])
> +        changequote(<<,>>)
> +        flex_version=`$FLEX --version 2>&1 \
> +          | $SED -n -e '/flex /b inspect
> +b
> +: inspect
> +s/.* (\{0,1\}\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\}.*/\1/;p'`
> +        changequote([,])
> +        AC_MSG_RESULT($flex_version)
> +
> +       AC_SUBST([FLEX_VERSION],[$flex_version])
> +
> +        AX_COMPARE_VERSION([$flex_version],[ge],[$ax_flex_version],[
> +           :
> +            $2
> +        ],[
> +           :
> +            $3
> +        ])
> +    ],[
> +        AC_MSG_WARN([could not find flex])
> +        $3
> +    ])
> +])
> diff --git a/configure.ac b/configure.ac
> index b274ead..b7af59a 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -455,6 +455,10 @@ if test ! -f
> "$srcdir/src/lib/lttng-ctl/filter/filter-lexer.c"; then
>                 AC_MSG_ERROR([[flex not found and is required when
> building from git.
>                 Please install flex]])
>         fi
> +       AC_PATH_PROG([FLEX],[flex])
> +       AX_PROG_FLEX_VERSION([2.5.35], [],[
> +               AC_MSG_ERROR([[Flex >= 2.5.35 is required when building
> from git]])
> +       ])
>  fi
>
>  CFLAGS="-Wall $CFLAGS -g -fno-strict-aliasing"
> --
> 2.1.4
>
>


-- 
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20150713/59f95098/attachment.html>


More information about the lttng-dev mailing list