summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@novell.com>2011-05-21 19:27:12 +0300
committerTor Lillqvist <tlillqvist@novell.com>2011-05-21 19:27:16 +0300
commit7fa06f6d5887cc40b9b2980cbf860e3b3f0f53d8 (patch)
tree7f41eafee5bf0cf4e38eb707eed8fc2c871085b7 /configure.in
parent9055a7bd32cf070ccaa111c2b257f1736c807beb (diff)
Improve Python detection for cross-compilation
Just hardcode known locations of cross-compilation Python packages for now.
Diffstat (limited to 'configure.in')
-rwxr-xr-xconfigure.in54
1 files changed, 39 insertions, 15 deletions
diff --git a/configure.in b/configure.in
index de3d7d7bc58a..8d20326c213c 100755
--- a/configure.in
+++ b/configure.in
@@ -266,6 +266,7 @@ AC_ARG_ENABLE(crashdump,
AC_ARG_ENABLE(python,
AS_HELP_STRING([--disable-python],
[Disable build of Python 2.x UNO API.]))
+
AC_ARG_ENABLE(gtk,
AS_HELP_STRING([--disable-gtk],
[Determines whether to use Gtk+ vclplug on platforms where Gtk+ is available.]),
@@ -729,7 +730,7 @@ AC_ARG_WITH(system-libxml,
AC_ARG_WITH(system-python,
AS_HELP_STRING([--with-system-python],
- [Use python already on system.]),
+ [Use Python already on system.]),
,with_system_python=yes)
AC_ARG_WITH(system-translate-toolkit,
@@ -746,15 +747,15 @@ AC_ARG_WITH(system-poppler,
AC_ARG_WITH(system-db,
AS_HELP_STRING([--with-system-db],
- [Use berkeley db already on system.]))
+ [Use Berkeley db already on system.]))
AC_ARG_WITH(system-lucene,
AS_HELP_STRING([--with-system-lucene],
- [Use lucene already on system.]))
+ [Use Lucene already on system.]))
AC_ARG_WITH(system-apache-commons,
AS_HELP_STRING([--with-system-apache-commons],
- [Use apache commons libraries already on system.]))
+ [Use Apache commons libraries already on system.]))
AC_ARG_WITH(lucene-core-jar,
AS_HELP_STRING([--with-lucene-core-jar=JARFILE],
@@ -4349,10 +4350,12 @@ fi
AC_MSG_CHECKING([which Python to use])
if test "$build_os" = "cygwin"; then
- # When building on Windows there is no system Python (When cross-compiling
- # to Windows from Linux using the mingw32-cross compiler from OBS, use
- # mingw32-python from OBS, and ditto for other MinGW cross-compilation
- # setups.)
+ dnl When building on Windows we don't attempt to use any installed
+ dnl "system" Python.
+ dnl
+ dnl (When cross-compiling to Windows from Linux using the mingw32-cross
+ dnl compiler from OBS, use mingw32-python from OBS, and ditto for other
+ dnl MinGW cross-compilation setups.)
with_system_python=no
fi
if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then
@@ -4364,14 +4367,34 @@ elif test -n "$with_system_python" -o -n "$with_system_libs" && \
test "$with_system_python" != "no"; then
with_system_python=yes
AC_MSG_RESULT([external])
+
+ dnl This searches for a *build* platform Python
AM_PATH_PYTHON([2.2])
- python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
- python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
- python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
- python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
- PYTHON_CFLAGS="-I$python_include"
- PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
+ if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then
+ dnl Fallback: Accept these in the environment.
+ :
+ elif test "$cross_compiling" != "yes"; then
+ python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
+ python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
+ python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
+ python_libdir=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBDIR'));"`
+ PYTHON_CFLAGS="-I$python_include"
+ PYTHON_LIBS="-L$python_libdir -lpython$python_version $python_libs"
+ else
+ dnl How to find out the cross-compilation Python installation path?
+ dnl Let's hardocode what we know for different distributions for now...
+ for python_sysroot in /usr/i686-w64-mingw32/sys-root/mingw ; do
+ for python_version in 2.6 ; do
+ if test -f ${python_sysroot}/include/python${python_version}/Python.h; then
+ PYTHON_CFLAGS="-I ${python_sysroot}/include/python$python_version"
+ PYTHON_LIBS="-L ${python_sysroot}lib -lpython$python_version $python_libs"
+ break
+ fi
+ done
+ test -n "$PYTHON_CFLAGS" && break
+ done
+ fi
fi
if test "$with_system_python" = "yes" ; then
SYSTEM_PYTHON=YES
@@ -4379,7 +4402,8 @@ if test "$with_system_python" = "yes" ; then
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $PYTHON_CFLAGS"
AC_CHECK_HEADER(Python.h, [],
- [AC_MSG_ERROR(Python headers not found)], [])
+ [AC_MSG_ERROR([Python headers not found. You probably want to set both the PYTHON_CFLAGS and PYTHON_LIBS environment variables.])],
+ [])
CPPFLAGS="$save_CPPFLAGS"
else
SYSTEM_PYTHON=NO