blob: 7d9bb511c09e3f6364d31a081bfecd46bd1900eb [file] [log] [blame]
Samuel Iglesias Gonsalvez2b37bea2014-11-21 08:53:21 +01001# ===========================================================================
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
41dnl macro that checks for mako module in python
42AC_DEFUN([AX_CHECK_PYTHON_MAKO_MODULE],
43[AC_MSG_CHECKING(if module mako in python is installed)
44 echo "
45try:
46 import sys
47 import mako
48except ImportError as err:
49 sys.exit(err)
50else:
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
Emil Velikov248eb542015-03-23 17:49:23 +000057 AC_MSG_RESULT(no)
Samuel Iglesias Gonsalvezced94252015-03-02 10:49:31 +010058 AC_SUBST(acv_mako_found, 'no')
Samuel Iglesias Gonsalvez2b37bea2014-11-21 08:53:21 +010059 else
Emil Velikov248eb542015-03-23 17:49:23 +000060 AC_MSG_RESULT(yes)
Samuel Iglesias Gonsalvezced94252015-03-02 10:49:31 +010061 AC_SUBST(acv_mako_found, 'yes')
Samuel Iglesias Gonsalvez2b37bea2014-11-21 08:53:21 +010062 fi
63])