diff options
author | Matúš Kukan <matus.kukan@gmail.com> | 2013-03-05 22:03:38 +0100 |
---|---|---|
committer | David Ostrovsky <David.Ostrovsky@gmx.de> | 2013-03-12 08:10:49 +0000 |
commit | e482672b5893cfd307d09a993fa83cb9be9aacb7 (patch) | |
tree | 4d6b0e371f864794906e91c4c3d4a6dd20d88dd2 /configure.ac | |
parent | 5a2cfa677356f77cda15365dd9107ce503e11dd4 (diff) |
use system python for building if possible
Also simplifies configure, hopefully without any mistake;)
Change-Id: I5c6c53fbee06cd1ecccf878a5c080274bfd950c1
Reviewed-on: https://gerrit.libreoffice.org/2563
Reviewed-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Tested-by: David Ostrovsky <David.Ostrovsky@gmx.de>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 169 |
1 files changed, 66 insertions, 103 deletions
diff --git a/configure.ac b/configure.ac index c9eac8303663..0241d925dbc9 100644 --- a/configure.ac +++ b/configure.ac @@ -4019,7 +4019,6 @@ if test "$cross_compiling" = "yes"; then ( unset COM GUI GUIBASE OS CPU CPUNAME unset CC CXX SYSBASE CFLAGS - unset PYTHON_CFLAGS PYTHON_LIBS unset AR NM OBJDUMP PKG_CONFIG RANLIB STRIP unset CPPUNIT_CFLAGS CPPUNIT_LIBS unset LIBXML_CFLAGS LIBXML_LIBS LIBXSLT_CFLAGS LIBXSLT_LIBS XSLTPROC @@ -4066,10 +4065,10 @@ if test "$cross_compiling" = "yes"; then cp config.log ../config.Build.log mkdir -p ../config_build cp config_host/*.h ../config_build - . ./bin/get_config_variables COM GUI OS PATH CPU CPUNAME CC CXX DISABLE_PYTHON MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH PYTHON SYSTEM_LIBXSLT OUTDIR WORKDIR + . ./bin/get_config_variables COM GUI OS PATH CPU CPUNAME CC CXX MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH SYSTEM_LIBXSLT OUTDIR WORKDIR - for V in COM GUI OS CPU CPUNAME CC CXX DISABLE_PYTHON MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \ - PYTHON SYSTEM_LIBXSLT; do + for V in COM GUI OS CPU CPUNAME CC CXX MACOSX_DEPLOYMENT_TARGET INPATH OUTPATH \ + SYSTEM_LIBXSLT; do VV='$'$V VV=`eval "echo $VV"` if test -n "$VV"; then @@ -4106,14 +4105,12 @@ else CPUNAME_FOR_BUILD="$CPUNAME" CPU_FOR_BUILD="$CPU" CXX_FOR_BUILD="$CXX" - DISABLE_PYTHON_FOR_BUILD="$DISABLE_PYTHON" GUI_FOR_BUILD="$GUI" INPATH_FOR_BUILD="$INPATH" MACOSX_DEPLOYMENT_TARGET_FOR_BUILD="$MACOSX_DEPLOYMENT_TARGET" OS_FOR_BUILD="$OS" OUTDIR_FOR_BUILD="$OUTDIR" OUTPATH_FOR_BUILD="$OUTPATH" - PYTHON_FOR_BUILD="$PYTHON" WORKDIR_FOR_BUILD="$WORKDIR" fi AC_SUBST(COM_FOR_BUILD) @@ -4126,7 +4123,6 @@ AC_SUBST(CXX_FOR_BUILD) AC_SUBST(INPATH_FOR_BUILD) AC_SUBST(OUTPATH_FOR_BUILD) AC_SUBST(MACOSX_DEPLOYMENT_TARGET_FOR_BUILD) -AC_SUBST([PYTHON_FOR_BUILD]) AC_SUBST(OUTDIR_FOR_BUILD) AC_SUBST(WORKDIR_FOR_BUILD) @@ -7262,29 +7258,42 @@ AC_SUBST(LIBXML_LIBS) AC_SUBST(XMLLINT) AC_SUBST([MINGW_LIBXML_DLL]) AC_SUBST([MINGW_ZLIB_DLL]) -dnl =================================================================== -dnl Checks for Python -dnl =================================================================== -AC_MSG_CHECKING([which Python to use]) +# ===================================================================== +# Checking for a Python interpreter with version >= 2.6 needed to build LO. +# Optionally user can pass an option to configure, i. e. +# ./configure PYTHON=/usr/bin/python +# ===================================================================== +# This allows a lack of system python with no error, we use internal one in that case. +AM_PATH_PYTHON([2.6],, [:]) +if test "$PYTHON" != ":"; then + PYTHON_FOR_BUILD=$PYTHON +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 $build_os = cygwin; then - # Python is required to build nss. In theory we could separate the build-time Python + if test -z $PYTHON_FOR_BUILD; 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? - AC_MSG_ERROR([Python is required at build time when building on Windows]) + AC_MSG_ERROR([Python is required at build time.]) fi enable_python=no AC_MSG_RESULT([none]) - DISABLE_PYTHON=TRUE ;; ""|yes|auto) - if test "$DISABLE_SCRIPTING" = TRUE -a $build_os != cygwin; then + if test "$DISABLE_SCRIPTING" = TRUE -a -n $PYTHON_FOR_BUILD; then AC_MSG_RESULT([no, overridden by --disable-scripting]) enable_python=no - DISABLE_PYTHON=TRUE + elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \) \ + -a \( "$with_macosx_sdk" = 10.4 -o "$with_macosx_sdk" = 10.5 \); then + # When building against a more recent SDK the ionternal Python can't be compiled, I can't be bothered to fix that for now, + # building against a recent SDK is only for developer's own builds anyway. + AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno]) + enable_python=internal elif test $build_os = cygwin; then dnl When building on Windows we don't attempt to use any installed dnl "system" Python. @@ -7294,22 +7303,28 @@ no|disable) dnl MinGW cross-compilation setups.) AC_MSG_RESULT([internal]) enable_python=internal - elif test $_os = Darwin -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \) \ - -a \( "$with_macosx_sdk" = 10.4 -o "$with_macosx_sdk" = 10.5 \); then - # When building against a more recent SDK the ionternal Python can't be compiled, I can't be bothered to fix that for now, - # building against a recent SDK is only for developer's own builds anyway. - AC_MSG_RESULT([internal, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno]) - enable_python=internal + elif test "$cross_compiling" = yes; then + AC_MSG_RESULT([system]) + enable_python=system else - AC_MSG_RESULT([checking below]) - enable_python=auto + # Unset variables set by the above AM_PATH_PYTHON so that + # we actually do check anew. + unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON + AM_PATH_PYTHON([3.3],, [:]) + if test "$PYTHON" = :; then + AC_MSG_RESULT([internal]) + enable_python=internal + else + AC_MSG_RESULT([system]) + enable_python=system + fi fi ;; internal) AC_MSG_RESULT([internal]) ;; system) - if test $_os = Darwin -a -z "$PYTHON" -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then + if test $_os = Darwin -a -z "$PYTHON_CFLAGS" -a \( "$with_macosx_version_min_required" = 10.4 -o "$with_macosx_version_min_required" = 10.5 \); then AC_MSG_ERROR([Cannot use "system" Python, the Python in Mac OS X $with_macosx_version_min_required is incompatible with Python3-ified pyuno]) fi AC_MSG_RESULT([system]) @@ -7319,86 +7334,40 @@ system) ;; esac -AC_SUBST(DISABLE_PYTHON) - -if test $_os = WINNT -a "$WITH_MINGW" != yes -a $enable_python = system; then - AC_MSG_ERROR([Must use internal Python when building with MSVC]) -fi - if test $enable_python != no; then BUILD_TYPE="$BUILD_TYPE PYUNO" fi -if test "$cross_compiling" = yes; then - if test $enable_python = auto; then - enable_python=system - fi -else - if test $enable_python = system -a -z "$PYTHON"; then - if test $_os = Darwin; then - # We already have logic above to make sure the system Python - # is used only when building against SDK 10.6 or newer. - - # Make sure we use the 2.6 Python when building against the - # 10.6 SDK. - case $with_macosx_sdk in - 10.6) - python_version=2.6;; - 10.7|10.8) - python_version=2.7;; - *) - # ??? - python_version=2.7;; - esac - PYTHON=python$python_version - PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}" - PYTHON_LIBS="-framework Python" - else - # This causes an error if no python command is found - AM_PATH_PYTHON([3.3]) - fi - elif test $enable_python = auto; then - # We should not come here in a MSVC build, I think? - if test $build_os = cygwin; then - AC_MSG_ERROR([Assertion failed - should not be here in a MSVC build]) - fi - - # This allows a lack of system Python 3.3 with no error, we check below for a system Python of - # earlier version. - AM_PATH_PYTHON([3.3],, [:]) - - if test "$PYTHON" = :; then - enable_python=internal - - if test $_os = Darwin; then - # See the fixme in gbuild.mk - - # There must be a system Python, 2.6 should be fine (?), to run build-time Python scripts - # like filter/source/svg/js2hxx.py. (Is that the only build-time Python script?) If we - # don't do this, PYTHON will stay with the value ":" which of course makes runing - # build-time Python scripts rather ineffective. +if test $enable_python = system; then + if test -z "$PYTHON_CFLAGS" -a $_os = Darwin; then + # We already have logic above to make sure the system Python + # is used only when building against SDK 10.6 or newer. - # Unset variables set by the above AM_PATH_PYTHON so that we acutally do check anew - # Finding an (old) system Python should not confuse our already decided intent to build an - # internal Python 3.3, that is directed by enable_python = internal. - unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON - AM_PATH_PYTHON([2.6]) - else - # For Linux it works to use the internally built Python, see gbuild.mk - : - fi - else - enable_python=system - fi + # Make sure we use the 2.6 Python when building against the + # 10.6 SDK. + case $with_macosx_sdk in + 10.6) + python_version=2.6;; + 10.7|10.8) + python_version=2.7;; + *) + # ??? + python_version=2.7;; + esac + PYTHON=python$python_version + PYTHON_CFLAGS="-I/Developer/SDKs/MacOSX${with_macosx_sdk}.sdk/System/Library/Frameworks/Python.framework/Versions/${python_version}/include/python${python_version}" + PYTHON_LIBS="-framework Python" fi -fi - -if test $enable_python = system; then if test -n "$PYTHON_CFLAGS" -a -n "$PYTHON_LIBS"; then # Fallback: Accept these in the environment, or as set above # for MacOSX. : elif test "$cross_compiling" != yes; then + # Unset variables set by the above AM_PATH_PYTHON so that + # we actually do check anew. + unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON + # This causes an error if no python command is found + AM_PATH_PYTHON([3.3]) 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'));"` @@ -7500,6 +7469,7 @@ internal) fi ;; no) + DISABLE_PYTHON=TRUE SYSTEM_PYTHON=NO ;; *) @@ -7507,14 +7477,7 @@ no) ;; esac -dnl Cross-build of python requires python that is runnable on the build -dnl platform, because it is used in the build process -if test "$cross_compiling" = yes; then - if test "$DISABLE_PYTHON" = no -a "$SYSTEM_PYTHON" = no -a "$DISABLE_PYTHON_FOR_BUILD" = yes; then - AC_MSG_ERROR([Cross-build of python requires python that is runnable on the build platform. You must not use --disable-python for the 'build' config.]) - fi -fi - +AC_SUBST(DISABLE_PYTHON) AC_SUBST(SYSTEM_PYTHON) AC_SUBST(PYTHON_CFLAGS) AC_SUBST(PYTHON_LIBS) |