Bug 783727 - Part 1: Capture Python version in configure; r=glandium

We now capture the Python version numbers in variables. Therefore,
configure can key off of these to influence behavior.
This commit is contained in:
Gregory Szorc 2012-09-19 11:20:07 -07:00
parent a3f5338aff
commit 39b1d6bab8

View File

@ -61,7 +61,8 @@ dnl Set the minimum version of toolkit libs used by mozilla
dnl ========================================================
GLIB_VERSION=1.2.0
PERL_VERSION=5.006
PYTHON_VERSION=2.5
PYTHON_VERSION_MAJOR=2
PYTHON_VERSION_MINOR=5
CAIRO_VERSION=1.10
PANGO_VERSION=1.14.0
GTK2_VERSION=2.10.0
@ -1836,13 +1837,20 @@ case "$host" in
esac
dnl We require version 2.5 or newer of Python to build.
AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION but not 3.x])
changequote(,)
$PYTHON -c "import sys; sys.exit(sys.version[:3] < sys.argv[1] or sys.version[:2] != '2.')" $PYTHON_VERSION
_python_res=$?
AC_MSG_CHECKING([for Python version >= $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR but not 3.x])
changequote(:)
read python_version_major python_version_minor python_version_micro <<EOF
`$PYTHON -c 'import sys; print sys.version_info[0], sys.version_info[1], sys.version_info[2]'`
EOF
changequote([,])
if test "$_python_res" != 0; then
AC_MSG_ERROR([Python $PYTHON_VERSION or higher (but not Python 3.x) is required.])
if test $python_version_major -ne $PYTHON_VERSION_MAJOR; then
AC_MSG_ERROR([Cannot build on Python $python_version_major.])
else
if test $python_version_minor -lt $PYTHON_VERSION_MINOR; then
AC_MSG_ERROR([Cannot build on Python $python_version_major.$python_version_minor. You need at least $PYTHON_VERSION_MAJOR.$PYTHON_VERSION_MINOR.])
fi
fi
AC_MSG_RESULT([yes])