Bug 783727 - Part 1: Capture Python version in configure; r=glandium
authorGregory Szorc <gps@mozilla.com>
Wed, 19 Sep 2012 11:20:07 -0700
changeset 107637 e9352b9ec6f8ab2c181a0c71e7d5181d2820185a
parent 107636 aa121eb778625b76a9ae54b5323c4d7143382663
child 107638 980d552c34ac320c62514ff67bb2f84645f948a1
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersglandium
bugs783727
milestone18.0a1
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.
configure.in
--- a/configure.in
+++ b/configure.in
@@ -56,17 +56,18 @@ MOZJPEG=62
 MOZPNG=10511
 NSPR_VERSION=4
 NSS_VERSION=3
 
 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
 WINDRES_VERSION=2.14.90
 W32API_VERSION=3.14
 GNOMEVFS_VERSION=2.0
 GNOMEUI_VERSION=2.2.0
 GCONF_VERSION=1.2.1
@@ -1831,23 +1832,30 @@ case "$host" in
 
 *)
     HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
     HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
     ;;
 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])
 
 dnl Check for using a custom <stdint.h> implementation
 dnl ========================================================
 AC_MSG_CHECKING(for custom <stdint.h> implementation)
 if test "$MOZ_CUSTOM_STDINT_H"; then
   AC_DEFINE_UNQUOTED(MOZ_CUSTOM_STDINT_H, "$MOZ_CUSTOM_STDINT_H")