Commit 6d8b29ba authored by Martin Pitt's avatar Martin Pitt

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.
parent 4e5556a5
......@@ -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.
......
-*- 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
])
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment