summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authordoko@ubuntu.com <doko@ubuntu.com>2012-06-30 20:42:45 +0200
committerdoko@ubuntu.com <doko@ubuntu.com>2012-06-30 20:42:45 +0200
commit1abe1c5fe13ca64c54e16db25de7c4dd5578a7c1 (patch)
tree8ea445f4288eaa7db6407625b0c74a22625d3b37 /configure.ac
parentb457b9be4deac2460cb8ac741af6a723d6cb4f88 (diff)
downloadcpython-git-1abe1c5fe13ca64c54e16db25de7c4dd5578a7c1.tar.gz
- Issue #14330: For cross builds, don't use host python, use host search paths
for host compiler.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac48
1 files changed, 48 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index c0ed024174..91a588a58c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -35,6 +35,27 @@ AC_CONFIG_HEADER(pyconfig.h)
AC_CANONICAL_HOST
+if test "$cross_compiling" = yes; then
+ AC_MSG_CHECKING([for python interpreter for cross build])
+ if test -z "$PYTHON_FOR_BUILD"; then
+ for interp in python$PACKAGE_VERSION python3 python; do
+ which $interp >/dev/null 2>&1 || continue
+ if $interp -c 'import sys;sys.exit(not sys.version_info@<:@:2@:>@ >= (3,3))'; then
+ break
+ fi
+ interp=
+ done
+ if test x$interp = x; then
+ AC_MSG_ERROR([python$PACKAGE_VERSION interpreter not found])
+ fi
+ AC_MSG_RESULT($interp)
+ PYTHON_FOR_BUILD="_PROJECT_BASE=$srcdir"' _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
+ fi
+else
+ PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
+fi
+AC_SUBST(PYTHON_FOR_BUILD)
+
dnl Ensure that if prefix is specified, it does not end in a slash. If
dnl it does, we get path names containing '//' which is both ugly and
dnl can cause trouble.
@@ -352,6 +373,29 @@ then
'') MACHDEP="unknown";;
esac
fi
+
+AC_SUBST(_PYTHON_HOST_PLATFORM)
+if test "$cross_compiling" = yes; then
+ case "$host" in
+ *-*-linux*)
+ case "$host_cpu" in
+ arm*)
+ _host_cpu=arm
+ ;;
+ *)
+ _host_cpu=$host_cpu
+ esac
+ ;;
+ *-*-cygwin*)
+ _host_cpu=
+ ;;
+ *)
+ # for now, limit cross builds to known configurations
+ MACHDEP="unknown"
+ AC_MSG_ERROR([cross build not supported for $host])
+ esac
+ _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
+fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
# disable features if it is defined, without any means to access these
@@ -913,6 +957,10 @@ else # shared is disabled
esac
fi
+if test "$cross_compiling" = yes; then
+ RUNSHARED=
+fi
+
AC_MSG_RESULT($LDLIBRARY)
AC_PROG_RANLIB