Home | History | Annotate | Download | only in m4
      1 # ===========================================================================
      2 #
      3 # SYNOPSIS
      4 #
      5 #   AX_CHECK_PYTHON_MAKO_MODULE(MIN_VERSION_NUMBER)
      6 #
      7 # DESCRIPTION
      8 #
      9 #   Check whether Python mako module is installed and its version higher than
     10 #   minimum requested.
     11 #
     12 #   Example of its use:
     13 #
     14 #   For example, the minimum mako version would be 0.7.3. Then configure.ac
     15 #   would contain:
     16 #
     17 #   AX_CHECK_PYTHON_MAKO_MODULE(0.7.3)
     18 #
     19 # LICENSE
     20 #
     21 #   Copyright (c) 2014 Intel Corporation.
     22 #
     23 #   Permission is hereby granted, free of charge, to any person obtaining a copy
     24 #   of this software and associated documentation files (the "Software"), to
     25 #   deal in the Software without restriction, including without limitation the
     26 #   rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
     27 #   sell copies of the Software, and to permit persons to whom the Software is
     28 #   furnished to do so, subject to the following conditions:
     29 #
     30 #   The above copyright notice and this permission notice shall be included in
     31 #   all copies or substantial portions of the Software.
     32 #
     33 #   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     34 #   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     35 #   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
     36 #   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     37 #   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     38 #   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
     39 #   IN THE SOFTWARE.
     40 
     41 dnl macro that checks for mako module in python
     42 AC_DEFUN([AX_CHECK_PYTHON_MAKO_MODULE],
     43 [AC_MSG_CHECKING(if module mako in python is installed)
     44     echo "
     45 try:
     46     import sys
     47     import mako
     48 except ImportError as err:
     49     sys.exit(err)
     50 else:
     51     ver_req = map(int, '$1'.split('.'))
     52     ver_act = map(int, mako.__version__.split('.'))
     53     sys.exit(int(ver_req > ver_act))
     54     " | $PYTHON2 -
     55 
     56     if test $? -ne 0 ; then
     57        AC_MSG_RESULT(no)
     58        AC_SUBST(acv_mako_found, 'no')
     59     else
     60        AC_MSG_RESULT(yes)
     61        AC_SUBST(acv_mako_found, 'yes')
     62     fi
     63 ])
     64