[Libreoffice-commits] .: 2 commits - configure.in

Tor Lillqvist tml at kemper.freedesktop.org
Sat May 21 09:27:50 PDT 2011


 configure.in |   54 +++++++++++++++++++++++++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 13 deletions(-)

New commits:
commit cc92f43e196a66bd046c75ccc0e4591812b58bc1
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Sat May 21 19:27:12 2011 +0300

    Improve Python detection for cross-compilation
    
    Just hardcode known locations of cross-compilation Python packages for
    now.

diff --git a/configure.in b/configure.in
index de3d7d7..8d20326 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
commit eac10d430afc70d0b0bccbf789dc62b9f8ad43b5
Author: Tor Lillqvist <tlillqvist at novell.com>
Date:   Sat May 21 17:36:56 2011 +0300

    Don't automatically avoid a "system" Python on Windows

diff --git a/configure.in b/configure.in
index 60991a0..de3d7d7 100755
--- a/configure.in
+++ b/configure.in
@@ -4347,8 +4347,12 @@ else
    AC_SUBST(DISABLE_PYTHON)
 fi
 
-AC_MSG_CHECKING([which python to use])
-if test "$_os" = "WINNT"; then
+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.)
    with_system_python=no
 fi
 if test "$_os" = "Darwin" && test "$with_system_python" != "no"; then


More information about the Libreoffice-commits mailing list