[pygobject] Add --with-python configure option
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Add --with-python configure option
- Date: Tue, 6 Nov 2012 10:23:18 +0000 (UTC)
commit 6d8b29ba56fb085948a155c75af36dcea9c71da8
Author: Martin Pitt <martinpitt gnome org>
Date: Tue Nov 6 11:21:32 2012 +0100
Add --with-python configure option
This behaves like setting $PYTHON, but also works in build systems like jhbuild
which do not support setting environment variables.
Update README accordingly.
README | 15 +++++++++------
configure.ac | 43 ++++++++++++++++++++++++++++++++++---------
2 files changed, 43 insertions(+), 15 deletions(-)
---
diff --git a/README b/README
index 9faf852..8d6ee0d 100644
--- a/README
+++ b/README
@@ -66,12 +66,15 @@ build, it should be as simple as running:
$ make
$ make install
-If your Python interpreter isn't in the path, or is not called
-"python", you can set the PYTHON environment variable to the full path
-of the interpreter:
-
- $ PYTHON=/prefix/bin/python
- $ export PYTHON
+By default, configure searches for a few well-known Python interpreter
+names, such as "python3", "python2", "python2.7", or "python". If your
+Python interpreter isn't in the path, or is not called "python", you can
+configure pygobject to build against that with --with-python=<path> or
+setting the PYTHON environment variable:
+
+ $ ./configure --with-python=python3
+ $ PYTHON=python3.2 ./configure
+ $ ./configure --with-python=~/my-patched-python/python
If configure can't find GTK+, you may need to set the PKG_CONFIG_PATH
environment variable to help it find the libraries.
diff --git a/configure.ac b/configure.ac
index ca9d5d2..6d8a0a8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,11 +1,17 @@
-*- mode: m4 -*-
AC_PREREQ(2.52)
-# The version of python used is determined by the executable pointed to 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:
-# $> PYTHON=python3 ./configure
+# 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
+
m4_define(python_min_ver, 2.6)
m4_define(python3_min_ver, 3.1)
@@ -85,6 +91,19 @@ AC_PROG_CC
AM_PROG_CC_STDC
AM_PROG_CC_C_O
+# 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
+
# check that we have the minimum version of python necessary to build
JD_PATH_PYTHON(python_min_ver)
@@ -130,7 +149,7 @@ AC_ARG_ENABLE(thread,
AM_CHECK_PYMOD(thread,,,enable_thread=check_for_py3_module)
if test "x$enable_thread" = xcheck_for_py3_module; then
dnl Python 3 uses the _thread module so check for that
- AM_CHECK_PYMOD(_thread,,,enable_thread=no)
+ AM_CHECK_PYMOD(_thread,,enable_thread=yes,enable_thread=no)
fi
AC_MSG_CHECKING(whether to enable threading in pygobject)
@@ -253,6 +272,12 @@ AC_CONFIG_FILES(
PKG-INFO)
AC_OUTPUT
-echo
-echo "libffi support: $have_libffi"
-echo
+AC_MSG_RESULT([
+ pygobject $VERSION
+
+ Using python interpreter: $PYTHON
+ libffi support: $have_libffi
+ cairo support: $enable_cairo
+ thread support: $enable_thread
+])
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]