[pyatspi2] Add --with-python option to configure.ac



commit 8ee7c9e1e37d23412d98b6363e01e992649e1aff
Author: Mike Gorse <mgorse suse com>
Date:   Tue Nov 6 10:50:57 2012 -0600

    Add --with-python option to configure.ac
    
    Add an option to specify the version of Python when running configure,
    to facilitate choosing the version of Python from a build system. Code
    lited from pygobject.

 configure.ac |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e19e700..0a32634 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,6 +1,17 @@
 AC_INIT([pyatspi], [2.7.1], [accessibility-atspi lists linux-foundation org])
 AC_CONFIG_AUX_DIR(config)
 
+# The version of python used is determined by the executable pointed to by the
+# --with-python switch, or if that's not set, by the PYTHON environment
+# variable.  For instance if your system installs Python 3 as python3 to
+# configure to compile pygobject under Python 3 you would do this:
+#   $ ./configure --with-python=python3
+# or
+#   $ PYTHON=python3 ./configure
+#
+# You can also build against a full interpreter path, such as
+#   $ ./configure --with-python=~/my-patched-python/python
+
 LT_RELEASE=$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION
 LT_CURRENT=0
 LT_REVISION=0
@@ -15,6 +26,20 @@ AC_SUBST(LT_AGE)
 AM_INIT_AUTOMAKE([-Wall foreign no-dist-gzip dist-xz])
 
 AC_PROG_CC
+
+# option to specify python interpreter to use; this just sets $PYTHON, so that
+# we will fallback to reading $PYTHON if --with-python is not given, and
+# python.m4 will get the expected input
+AC_ARG_WITH(python,
+  AC_HELP_STRING([--with-python=PATH], [Path to Python interpreter; searches $PATH if only a program name is given; if not given, searches for a few standard names such as "python3" or "python2"]),
+  [PYTHON="$withval"], [])
+if test x"$PYTHON" = xyes; then
+	AC_MSG_ERROR([--with-python option requires a path or program argument])
+fi
+if test -n "$PYTHON" && ! which "$PYTHON"; then
+	AC_MSG_ERROR([Python interpreter $PYTHON does not exist])
+fi
+
 AM_PATH_PYTHON(2.6)
 AM_DISABLE_STATIC
 AM_PROG_LIBTOOL



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]