Martin v. Löwis wrote:
What about to start to resolve issues step by step ?
The first step surely should be to get the autoconf issue resolved.
I don't think distutils cross-compilation is going to work, instead,
people wishing to cross-compile should edit Modules/Setup.
Regards,
Martin
Please find attached file "python-2.5.2.patch-CROSS".
Note that this is "proof of concept" unified diff only for configure.in
to show only some changes required for cross-compilation:
- added macro AC_CANONICAL_HOST: this require files config.guess and
config.sub to be copied to top source directiory. The files can be
obtained from GNU automake distribution. In my test I use files from
automake 1.10.1.
- makefile conditional: the idea is to use in makefiles. It seems to me
that build for PGEN (Parser from Makefile.pre.in) has to be suppress in
case of cross-compilation as example (without related changes):
=
# Parser
@[EMAIL PROTECTED] Parser/pgen$(EXE)
=
- search for python in build system: usually in the cross environment
we cann't run just build python executable we may use existing
interpreter as example in Makefile.pre.in:
=
@[EMAIL PROTECTED] [EMAIL PROTECTED]@ @SYSPYTHON@
@[EMAIL PROTECTED] $(RUNSHARED) ./$(BUILDPYTHON)
=
- $ac_sys_system vs $host: the attached diff show how to detect host
system. The existing detection (variable $ac_sys_system) isn't suitable
for cross-environment.
- ar program : macro AC_CHECK_TOOLS replace AC_CHECK_PROGS. for more
details see autoconf texinfo page.
- detection of files: skip detection in cross-env. and by default assume
that file don't exists. This is minimal change and I think that we
has to use macro AC_CHECK_FILE and in cross-env. to warn user but this
require more changes.
- creation of files from configure script (note this is not related
directly to cross compilation): the script is changed to use macros
AC_CONFIG_COMMANDS{_PRE}, i.e. more autoconf friendly.
I would like to know what is acceptable for above changes ?
(note that changes for mingw are only to show idea how to get host
system and i will exclude from final patch ).
Also how to proceed ?
Must I open new issue and to mark that as example 1597850 depend from
new one ?
What is preferred patch: against trunk, release2.5 or both ?
Roumen
--- ./configure.in.CROSS2008-02-13 21:17:17.0 +0200
+++ ./configure.in 2008-08-19 03:11:48.0 +0300
@@ -8,6 +8,7 @@
AC_INIT(python, PYTHON_VERSION, http://www.python.org/python-bugs)
AC_CONFIG_SRCDIR([Include/object.h])
AC_CONFIG_HEADER(pyconfig.h)
+AC_CANONICAL_HOST
dnl This is for stuff that absolutely must end up in pyconfig.h.
dnl Please use pyport.h instead, if possible.
@@ -30,6 +31,36 @@
rm confdefs.h
mv confdefs.h.new confdefs.h
+dnl makefile conditional (for future use)
+if test "x$cross_compiling" = xyes; then
+ CROSS_ON=''
+ CROSS_OFF='#'
+else
+ CROSS_ON='#'
+ CROSS_OFF=''
+fi
+AC_SUBST(CROSS_ON)
+AC_SUBST(CROSS_OFF)
+
+if test "x$cross_compiling" = xyes; then
+ AC_MSG_NOTICE([cross-compilation is incomplete])
+
+ dnl in cross-compilation environment we need python from
+ dnl build system (for future use)
+ AC_PATH_PROG(SYSPYTHON, python, [none],
+[$PATH:/usr/local/bin]
+ )
+ if test "x$PYTHON" = xnone; then
+AC_MSG_ERROR([python program is required in cross-compilation environment])
+ fi
+
+ dnl HOST_OS is a variable to be used in makefiles to inform other
+ dnl tools for real host system if differ from build system
+ dnl (reserved for future use)
+ HOST_OS=$host_os
+fi
+AC_SUBST(HOST_OS)
+
AC_SUBST(VERSION)
VERSION=PYTHON_VERSION
@@ -585,6 +616,10 @@
*)
enable_shared="no";;
esac
+ case $host in
+ *-*-mingw*)
+enable_shared="yes";;
+ esac
fi
AC_MSG_RESULT($enable_shared)
@@ -593,11 +628,11 @@
AC_HELP_STRING(--enable-profiling, enable C-level code
profiling),
[ac_save_cc="$CC"
CC="$CC -pg"
- AC_TRY_RUN([int main() { return 0; }],
+ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[[int main() { return 0; }]])],
ac_enable_profiling="yes",
- ac_enable_profiling="no",
ac_enable_profiling="no")
- CC="$ac_save_cc"])
+ CC="$ac_save_cc"],
+ ac_enable_profiling="no")
AC_MSG_RESULT($ac_enable_profiling)
case "$ac_enable_profiling" in
@@ -675,6 +710,13 @@
RUNSHARED=DLL_PATH=`pwd`:${DLL_PATH:-/atheos/sys/libs:/atheos/autolnk/lib}
;;
esac
+ case $host in
+*-*-mingw*)
+ LDLIBRARY='libpython$(VERSION).dll.a'
+ DLLLIBRARY='libpython$(VERSION).dll'
+ BLDLIBRARY='-L. -lpython$(VERSION)'
+ ;;
+ esac
else # shared is disabled
case $ac_sys_system in
CYGWIN*)
@@ -682,13 +724,16 @@
LDLIBRARY='libpython$(VERSION).dll.a'
;;
esac
+ case $host in
+*-*-mingw*)
+ LDLIBRARY='libpython$(VERSION).dll.a';;
+ esac
fi
AC_MSG_RESULT($LDLIBRARY)
AC_PROG_RANLIB
-AC_SUBST(AR)
-AC_CHECK_PROGS(AR,