Collection of DPF-based plugins for packaging
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

70 lines
2.0KB

  1. # ===========================================================================
  2. # https://www.gnu.org/software/autoconf-archive/ax_prog_flex_version.html
  3. # ===========================================================================
  4. #
  5. # SYNOPSIS
  6. #
  7. # AX_PROG_FLEX_VERSION([VERSION],[ACTION-IF-TRUE],[ACTION-IF-FALSE])
  8. #
  9. # DESCRIPTION
  10. #
  11. # Makes sure that flex version is greater or equal to the version
  12. # indicated. If true the shell commands in ACTION-IF-TRUE are executed. If
  13. # not the shell commands in commands in ACTION-IF-TRUE are executed. If
  14. # not the shell commands in ACTION-IF-FALSE are run. Note if $FLEX is not
  15. # set (for example by running AC_CHECK_PROG or AC_PATH_PROG) the macro
  16. # will fail.
  17. #
  18. # Example:
  19. #
  20. # AC_PATH_PROG([FLEX],[flex])
  21. # AX_PROG_FLEX_VERSION([2.5.39],[ ... ],[ ... ])
  22. #
  23. # This will check to make sure that the flex you have is at least version
  24. # 2.5.39 or greater.
  25. #
  26. # NOTE: This macro uses the $FLEX variable to perform the check.
  27. #
  28. # LICENSE
  29. #
  30. # Copyright (c) 2015 Jonathan Rajotte-Julien <jonathan.rajotte-julien@efficios.com>
  31. #
  32. # Copying and distribution of this file, with or without modification, are
  33. # permitted in any medium without royalty provided the copyright notice
  34. # and this notice are preserved. This file is offered as-is, without any
  35. # warranty.
  36. #serial 2
  37. AC_DEFUN([AX_PROG_FLEX_VERSION],[
  38. AC_REQUIRE([AC_PROG_SED])
  39. AC_REQUIRE([AC_PROG_GREP])
  40. AS_IF([test -n "$FLEX"],[
  41. ax_flex_version="$1"
  42. AC_MSG_CHECKING([for flex version])
  43. changequote(<<,>>)
  44. flex_version=`$FLEX --version 2>&1 \
  45. | $SED -n -e '/flex /b inspect
  46. b
  47. : inspect
  48. s/.* (\{0,1\}\([0-9]*\.[0-9]*\.[0-9]*\))\{0,1\}.*/\1/;p'`
  49. changequote([,])
  50. AC_MSG_RESULT($flex_version)
  51. AC_SUBST([FLEX_VERSION],[$flex_version])
  52. AX_COMPARE_VERSION([$flex_version],[ge],[$ax_flex_version],[
  53. :
  54. $2
  55. ],[
  56. :
  57. $3
  58. ])
  59. ],[
  60. AC_MSG_WARN([could not find flex])
  61. $3
  62. ])
  63. ])