summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Iglesias Gonsalvez <siglesias@igalia.com>2014-11-21 08:53:21 +0100
committerIago Toral Quiroga <itoral@igalia.com>2015-01-12 11:20:28 +0100
commit2b37bea010a9c9333a813cc77d28629e1382c0be (patch)
treea4bb048039f0a1dbc3e63b0d3feedf22b5668ef0
parentf89793946af22b720f746a5fb8b33d7b2f3e199b (diff)
configure: require python mako module
It is now a hard dependency because of the autogeneration of format pack and unpack functions. Update the documentation to reflect this change. v2: - Inline python script in m4 file and use PYTHON2 v3: - Remove semicolons and quotes and change coding style - Add Ilia Mirkin suggestion to use Python's split functionality. - Use AX_CHECK_PYTHON_MAKO_MODULE name. - Change to MIT license Signed-off-by: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
-rw-r--r--configure.ac2
-rw-r--r--docs/install.html6
-rw-r--r--m4/ax_check_python_mako_module.m461
3 files changed, 68 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index c8723ef26cf..d4cf4b8c0b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,8 @@ if test "x$INDENT" != "xcat"; then
AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool')
fi
+AX_CHECK_PYTHON_MAKO_MODULE(0.7.3)
+
AC_PROG_INSTALL
dnl We need a POSIX shell for parts of the build. Assume we have one
diff --git a/docs/install.html b/docs/install.html
index f12425fcb68..b12e1cb8cd9 100644
--- a/docs/install.html
+++ b/docs/install.html
@@ -38,6 +38,10 @@
Version 2.6.4 or later should work.
</li>
<br>
+<li><a href="http://www.makotemplates.org/">Python Mako module</a> -
+Python Mako module is required. Version 0.7.3 or later should work.
+</li>
+</br>
<li><a href="http://www.scons.org/">SCons</a> is required for building on
Windows and optional for Linux (it's an alternative to autoconf/automake.)
</li>
@@ -78,7 +82,7 @@ the needed dependencies:
<pre>
sudo yum install flex bison imake libtool xorg-x11-proto-devel libdrm-devel \
gcc-c++ xorg-x11-server-devel libXi-devel libXmu-devel libXdamage-devel git \
- expat-devel llvm-devel
+ expat-devel llvm-devel python-mako
</pre>
diff --git a/m4/ax_check_python_mako_module.m4 b/m4/ax_check_python_mako_module.m4
new file mode 100644
index 00000000000..2fc029b9a2b
--- /dev/null
+++ b/m4/ax_check_python_mako_module.m4
@@ -0,0 +1,61 @@
+# ===========================================================================
+#
+# SYNOPSIS
+#
+# AX_CHECK_PYTHON_MAKO_MODULE(MIN_VERSION_NUMBER)
+#
+# DESCRIPTION
+#
+# Check whether Python mako module is installed and its version higher than
+# minimum requested.
+#
+# Example of its use:
+#
+# For example, the minimum mako version would be 0.7.3. Then configure.ac
+# would contain:
+#
+# AX_CHECK_PYTHON_MAKO_MODULE(0.7.3)
+#
+# LICENSE
+#
+# Copyright (c) 2014 Intel Corporation.
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+# IN THE SOFTWARE.
+
+dnl macro that checks for mako module in python
+AC_DEFUN([AX_CHECK_PYTHON_MAKO_MODULE],
+[AC_MSG_CHECKING(if module mako in python is installed)
+ echo "
+try:
+ import sys
+ import mako
+except ImportError as err:
+ sys.exit(err)
+else:
+ ver_req = map(int, '$1'.split('.'))
+ ver_act = map(int, mako.__version__.split('.'))
+ sys.exit(int(ver_req > ver_act))
+ " | $PYTHON2 -
+
+ if test $? -ne 0 ; then
+ AC_MSG_ERROR(mako $1 or later is required.)
+ else
+ AC_MSG_RESULT(yes)
+ fi
+])