]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Allow specifying Python version during configure
authorAnirudha Bose <ani07nov@gmail.com>
Wed, 25 May 2016 19:44:47 +0000 (01:14 +0530)
committerAnirudha Bose <ani07nov@gmail.com>
Sun, 19 Jun 2016 14:48:24 +0000 (20:18 +0530)
* Uses the PYTHON environment variable allowed by configure scripts
* Supports running inside Python virtual environments, in which case,
  setting the PYTHON variable is not required.
* Example: $ PYTHON=python3.5 ./configure

Signed-off-by: Anirudha Bose <ani07nov@gmail.com>
configure.ac

index b6453b187393d79c7f10396d2c5f70931b20a236..0493673af36df30bc1387a6a0a5cd63259544cc9 100644 (file)
@@ -221,13 +221,27 @@ if test x"$with_cython" = xyes; then
     if test x"$CYTHON_CHECK" != xyes; then
         AC_MSG_FAILURE([cython not found])
     fi
-    AC_CHECK_PROG(PYTHON_CONFIG_CHECK, python-config, yes)
+
+    # Check if we are running inside a Python virtual environment
+    # Both `virtualenv' as well as PEP 405 `pyvenv' set the VIRTUAL_ENV
+    # environment variable upon activation
+    if test x"$VIRTUAL_ENV" != x; then
+        PYTHON="python"
+    fi
+
+    # Set PYTHON to default system Python version if not specified
+    if test x"$PYTHON" = x; then
+        PYTHON="python"
+    fi
+
+    AC_CHECK_PROG(PYTHON_CONFIG_CHECK, "$PYTHON"-config, yes)
     if test x"$PYTHON_CONFIG_CHECK" != xyes; then
-        AC_MSG_FAILURE([python-config not found])
+        AC_MSG_FAILURE(["$PYTHON"-config not found])
     fi
-    PYTHON_CFLAGS=`python-config --cflags`
+
+    PYTHON_CFLAGS=`"$PYTHON"-config --cflags`
     AC_SUBST(PYTHON_CFLAGS)
-    PYTHON_LDFLAGS=`python-config --ldflags`
+    PYTHON_LDFLAGS=`"$PYTHON"-config --ldflags`
     AC_SUBST(PYTHON_LDFLAGS)
 fi