configure.ac |   45 ++++++++++++++++++++++++---------------------
 1 file changed, 24 insertions(+), 21 deletions(-)

New commits:
commit 748b8ad4184130b74ae3fdd7178be2999948d64e
Author:     Jan-Marek Glogowski <glo...@fbihome.de>
AuthorDate: Mon May 17 16:21:01 2021 +0200
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Thu Dec 9 15:43:51 2021 +0100

    Make sure Python is in build for the cross-toolset
    
    Change-Id: I4c25f572cb942759990eaacb7ca261c78831ed40
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116124
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/configure.ac b/configure.ac
index bb51b6f76d16..ddc9c1d0500d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9634,28 +9634,26 @@ if test "$build_os" != "cygwin" -a "$enable_python" != 
fully-internal; then
         fi
     fi
 fi
-AC_SUBST(PYTHON_FOR_BUILD)
 
 # Checks for Python to use for Pyuno
 AC_MSG_CHECKING([which Python to use for Pyuno])
 case "$enable_python" in
 no|disable)
-    if test -z $PYTHON_FOR_BUILD; then
+    if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
         # Python is required to build LibreOffice. In theory we could separate 
the build-time Python
         # requirement from the choice whether to include Python stuff in the 
installer, but why
         # bother?
-        if test "$cross_compiling" = yes; then
-            enable_python=system
-        else
-            AC_MSG_ERROR([Python is required at build time.])
-        fi
+        AC_MSG_ERROR([Python is required at build time.])
     fi
     enable_python=no
     AC_MSG_RESULT([none])
     ;;
 ""|yes|auto)
-    if test "$DISABLE_SCRIPTING" = TRUE -a -n "$PYTHON_FOR_BUILD"; then
-        AC_MSG_RESULT([no, overridden by --disable-scripting])
+    if test "$DISABLE_SCRIPTING" = TRUE; then
+        if test -z "$PYTHON_FOR_BUILD" -a "$cross_compiling" != yes; then
+            AC_MSG_ERROR([Python support can't be disabled without 
cross-compiling or a system python.])
+        fi
+        AC_MSG_RESULT([none, overridden by --disable-scripting])
         enable_python=no
     elif test $build_os = cygwin; then
         dnl When building on Windows we don't attempt to use any installed
@@ -9797,6 +9795,22 @@ if test "$with_lxml" != no; then
     fi
 fi
 
+if test \( "$cross_compiling" = yes -a -z "$PYTHON_FOR_BUILD" \) -o 
"$enable_python" = internal; then
+    SYSTEM_PYTHON=
+    PYTHON_VERSION_MAJOR=3
+    PYTHON_VERSION_MINOR=8
+    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
+    if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
+        AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in 
download.lst])
+    fi
+    AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
+
+    # Embedded Python dies without Home set
+    if test "$HOME" = ""; then
+        export HOME=""
+    fi
+fi
+
 dnl By now enable_python should be "system", "internal" or "no"
 case $enable_python in
 system)
@@ -9823,22 +9837,10 @@ int main(int argc, char **argv) {
     ;;
 
 internal)
-    SYSTEM_PYTHON=
-    PYTHON_VERSION_MAJOR=3
-    PYTHON_VERSION_MINOR=8
-    PYTHON_VERSION=${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}.10
-    if ! grep -q -i python.*${PYTHON_VERSION} ${SRC_ROOT}/download.lst; then
-        AC_MSG_ERROR([PYTHON_VERSION ${PYTHON_VERSION} but no matching file in 
download.lst])
-    fi
-    AC_DEFINE_UNQUOTED([PYTHON_VERSION_STRING], [L"${PYTHON_VERSION}"])
     BUILD_TYPE="$BUILD_TYPE PYTHON"
     if test "$OS" = LINUX -o "$OS" = WNT ; then
         BUILD_TYPE="$BUILD_TYPE LIBFFI"
     fi
-    # Embedded Python dies without Home set
-    if test "$HOME" = ""; then
-        export HOME=""
-    fi
     ;;
 no)
     DISABLE_PYTHON=TRUE
@@ -9852,6 +9854,7 @@ esac
 AC_SUBST(DISABLE_PYTHON)
 AC_SUBST(SYSTEM_PYTHON)
 AC_SUBST(PYTHON_CFLAGS)
+AC_SUBST(PYTHON_FOR_BUILD)
 AC_SUBST(PYTHON_LIBS)
 AC_SUBST(PYTHON_VERSION)
 AC_SUBST(PYTHON_VERSION_MAJOR)

Reply via email to