diff -r d0cce5a2c0cf Makefile.pre.in --- a/Makefile.pre.in Thu Mar 15 22:19:28 2012 +0100 +++ b/Makefile.pre.in Fri Mar 16 01:11:05 2012 +0100 @@ -193,6 +193,8 @@ PYTHON= python$(EXE) BUILDPYTHON= python$(BUILDEXE) +PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@ + # The task to run while instrument when building the profile-opt target PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py @@ -441,6 +443,7 @@ $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" run_profile_task: + : # FIXME: can't run for a cross build ./$(BUILDPYTHON) $(PROFILE_TASK) build_all_use_profile: @@ -457,18 +460,17 @@ $(LINKCC) $(PY_LDFLAGS) $(LINKFORSHARED) -o $@ Modules/python.o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) platform: $(BUILDPYTHON) $(SYSCONFIGDATA) - $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform + $(RUNSHARED) $(PYTHON_FOR_BUILD) -c 'import sys ; from sysconfig import get_platform ; print(get_platform()+"-"+sys.version[0:3])' >platform # Generate the sysconfig build-time data $(SYSCONFIGDATA): $(BUILDPYTHON) - $(RUNSHARED) ./$(BUILDPYTHON) -SE -m sysconfig --generate-posix-vars + $(RUNSHARED) $(PYTHON_FOR_BUILD) -S -m sysconfig --generate-posix-vars # Build the shared modules sharedmods: $(BUILDPYTHON) $(SYSCONFIGDATA) - @case $$MAKEFLAGS in \ - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ - esac + case $$MAKEFLAGS in *s*) quiet=-s; esac; \ + $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build # Build static library # avoid long command lines, same as LIBRARY_OBJS diff -r d0cce5a2c0cf configure.ac --- a/configure.ac Thu Mar 15 22:19:28 2012 +0100 +++ b/configure.ac Fri Mar 16 01:11:05 2012 +0100 @@ -35,6 +35,27 @@ 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='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. @@ -835,6 +856,10 @@ esac fi +if test "$cross_compiling" = yes; then + RUNSHARED= +fi + AC_MSG_RESULT($LDLIBRARY) AC_PROG_RANLIB