--- ./Makefile.pre.in.CROSS 2008-08-06 23:38:07.000000000 +0300 +++ ./Makefile.pre.in 2008-08-31 22:33:58.000000000 +0300 @@ -468,12 +468,7 @@ Modules/Setup.config \ Modules/Setup \ Modules/Setup.local - $(SHELL) $(MAKESETUP) -c $(srcdir)/Modules/config.c.in \ - -s Modules \ - Modules/Setup.config \ - Modules/Setup.local \ - Modules/Setup - @mv config.c Modules + $(SHELL) ./config.status Makefile @echo "The Makefile was updated, you may need to re-run make." @@ -1080,7 +1075,7 @@ # Build the toplevel Makefile Makefile.pre: Makefile.pre.in config.status - CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status + $(SHELL) ./config.status $@ $(MAKE) -f Makefile.pre Makefile # Run the configure script. --- ./configure.in.CROSS 2008-08-18 22:39:27.000000000 +0300 +++ ./configure.in 2008-09-02 00:29:21.000000000 +0300 @@ -11,6 +11,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. @@ -33,6 +34,30 @@ 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_WARN([cross-compilation is incomplete]) + + dnl In cross-compilation environment we need python from + dnl the 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 +fi + AC_SUBST(VERSION) VERSION=PYTHON_VERSION @@ -211,8 +236,39 @@ ## Use (OpenStep|Rhapsody) dynamic linker)) ## # Set name for machine-dependent library files +dnl Now configure script support cross-compilation and detection of host +dnl system based on value of $ac_sys_system and/or $ac_sys_release +dnl has to be avoided. It is superseded by "host triplet"(cpu-verdor-os). +dnl FIXME: replace all cases based on $ac_sys_system and/or $ac_sys_release +dnl with case based on $host ("host triplet") or $host_os. +dnl Also cases with MACHDEP may be replaces by $host or $host_os. Note +dnl script may not set this variable if cross compiling. + +dnl Next two variables are intended to be passed through makefile to other +dnl scripts. As example setup.py check for CPU(machine) and OS(platform). +HOST_CPU=$host_cpu +AC_SUBST(HOST_CPU) +HOST_OS=$host_os +AC_SUBST(HOST_OS) + AC_SUBST(MACHDEP) +if test "x$cross_compiling" = xyes; then +AC_MSG_WARN([ + May be value of MACHDEP isn't correct if cross-compiling. + You may tweak configure script for you host system: $host]) +fi AC_MSG_CHECKING(MACHDEP) +dnl Note that $host_os cann't be translated directly into python +dnl specific $MACHDEP. As example on linux (kernel 2.x) the script below +dnl will set MACHDEP to "linux2" but $host_os is only "linux". +dnl Another point is in cross-compilation environment we cannot distinguish +dnl linux with 1.x(if someone still use it) and 2.x host kernels. +dnl As example setup.py check for linux2(get from sys.platform) and will +dnl install some host plaform specific files into subdirectory "plat-linux2". +dnl In addition $host_os may contain specific settings for some host systems +dnl as example mingwNN{YYYY} but the host winNN. So we may set MACHDEP +dnl to winNN in this case, i.e. different host systems from gnu autotools +dnl point of view but same for python. if test -z "$MACHDEP" then ac_sys_system=`uname -s` @@ -229,14 +285,18 @@ MACHDEP="$ac_md_system$ac_md_release" case $MACHDEP in - cygwin*) MACHDEP="cygwin";; - darwin*) MACHDEP="darwin";; - atheos*) MACHDEP="atheos";; irix646) MACHDEP="irix6";; '') MACHDEP="unknown";; esac + + dnl override MACHDEP only on certain host systems + case $host in + *-*-cygwin*) MACHDEP="cygwin";; + *-*-darwin*) MACHDEP="darwin";; + *-*-atheos*) MACHDEP="atheos";; + esac fi - + # Some systems cannot stand _XOPEN_SOURCE being defined at all; they # disable features if it is defined, without any means to access these # features as extensions. For these systems, we skip the definition of @@ -388,10 +448,6 @@ CONFIGURE_MACOSX_DEPLOYMENT_TARGET= EXPORT_MACOSX_DEPLOYMENT_TARGET='#' -AC_MSG_CHECKING(machine type as reported by uname -m) -ac_sys_machine=`uname -m` -AC_MSG_RESULT($ac_sys_machine) - # checks for alternative programs # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just @@ -513,6 +569,13 @@ AC_AIX # Check for unsupported systems +case $host in + *-*-beos*) + AC_MSG_WARN([ + Support for BeOS is deprecated as of Python 2.6. + See PEP 11 for the gory details. + ]);; +esac case $ac_sys_system/$ac_sys_release in atheos*|Linux*/1*) echo This system \($ac_sys_system/$ac_sys_release\) is no longer supported. @@ -653,22 +716,23 @@ AC_MSG_CHECKING(for --enable-profiling) AC_ARG_ENABLE(profiling, - 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_enable_profiling="yes", - ac_enable_profiling="no", - ac_enable_profiling="no") - CC="$ac_save_cc"]) -AC_MSG_RESULT($ac_enable_profiling) - -case "$ac_enable_profiling" in - "yes") - BASECFLAGS="-pg $BASECFLAGS" - LDFLAGS="-pg $LDFLAGS" - ;; -esac + AC_HELP_STRING([--enable-profiling], [enable C-level code profiling])) +if test "x$enable_profiling" = xyes; then + py_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -pg" + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], + [], + [enable_profiling=no]) + CFLAGS="$py_save_CFLAGS" +else + enable_profiling=no +fi +AC_MSG_RESULT($enable_profiling) + +if test "x$enable_profiling" = xyes; then + BASECFLAGS="-pg $BASECFLAGS" + LDFLAGS="-pg $LDFLAGS" +fi AC_MSG_CHECKING(LDLIBRARY) @@ -750,8 +814,7 @@ AC_MSG_RESULT($LDLIBRARY) AC_PROG_RANLIB -AC_SUBST(AR) -AC_CHECK_PROGS(AR, ar aal, ar) +AC_CHECK_TOOLS(AR, ar aal, ar) AC_SUBST(SVNVERSION) AC_CHECK_PROG(SVNVERSION, svnversion, found, not-found) @@ -875,9 +938,8 @@ AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" - AC_TRY_RUN([int main() { return 0; }], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], ac_cv_no_strict_aliasing_ok=yes, - ac_cv_no_strict_aliasing_ok=no, ac_cv_no_strict_aliasing_ok=no) CC="$ac_save_cc" AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) @@ -889,7 +951,7 @@ # if using gcc on alpha, use -mieee to get (near) full IEEE 754 # support. Without this, treatment of subnormals doesn't follow # the standard. - case $ac_sys_machine in + case $host in alpha*) BASECFLAGS="$BASECFLAGS -mieee" ;; @@ -996,9 +1058,8 @@ AC_CACHE_VAL(ac_cv_opt_olimit_ok, [ac_save_cc="$CC" CC="$CC -OPT:Olimit=0" -AC_TRY_RUN([int main() { return 0; }], +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], ac_cv_opt_olimit_ok=yes, - ac_cv_opt_olimit_ok=no, ac_cv_opt_olimit_ok=no) CC="$ac_save_cc"]) AC_MSG_RESULT($ac_cv_opt_olimit_ok) @@ -1018,9 +1079,8 @@ AC_CACHE_VAL(ac_cv_olimit_ok, [ac_save_cc="$CC" CC="$CC -Olimit 1500" - AC_TRY_RUN([int main() { return 0; }], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], ac_cv_olimit_ok=yes, - ac_cv_olimit_ok=no, ac_cv_olimit_ok=no) CC="$ac_save_cc"]) AC_MSG_RESULT($ac_cv_olimit_ok) @@ -2442,7 +2502,11 @@ else MACHDEP_OBJS="$MACHDEP_OBJS $extra_machdep_objs" fi -AC_MSG_RESULT(MACHDEP_OBJS) +if test -z "$MACHDEP_OBJS"; then + AC_MSG_RESULT([none]) +else + AC_MSG_RESULT([$MACHDEP_OBJS]) +fi # checks for library functions AC_CHECK_FUNCS(alarm setitimer getitimer bind_textdomain_codeset chown \ @@ -2556,10 +2620,13 @@ AC_CHECK_LIB(resolv, inet_aton) ) +AC_CHECK_FUNCS(chflags, +[ # On Tru64, chflags seems to be present, but calling it will # exit Python -AC_MSG_CHECKING(for chflags) -AC_TRY_RUN([ +AC_MSG_CHECKING(for working chflags) +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[ #include #include int main(int argc, char*argv[]) @@ -2568,13 +2635,20 @@ return 1; return 0; } -],AC_DEFINE(HAVE_CHFLAGS, 1, Define to 1 if you have the `chflags' function.) - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no) +]])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE(BROKEN_CHFLAGS, 1, [Define to 1 if you `chflags' function is broken.]) + ], + [AC_MSG_RESULT([cross-compiling, assuming yes])] ) +]) -AC_MSG_CHECKING(for lchflags) -AC_TRY_RUN([ +AC_CHECK_FUNCS(lchflags, +[ +AC_MSG_CHECKING(for working lchflags) +AC_RUN_IFELSE( +[AC_LANG_SOURCE([[ #include #include int main(int argc, char*argv[]) @@ -2583,10 +2657,14 @@ return 1; return 0; } -],AC_DEFINE(HAVE_LCHFLAGS, 1, Define to 1 if you have the `lchflags' function.) - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no) +]])], + [AC_MSG_RESULT(yes)], + [AC_MSG_RESULT(no) + AC_DEFINE(BROKEN_LCHFLAGS, 1, [Define to 1 if you `lchflags' function is broken.]) + ], + [AC_MSG_RESULT([cross-compiling, assuming yes])] ) +]) dnl Check if system zlib has *Copy() functions dnl @@ -3603,30 +3681,46 @@ AC_MSG_RESULT(no) ) -AC_MSG_CHECKING(for /dev/ptmx) - -if test -r /dev/ptmx -then - AC_MSG_RESULT(yes) +# check for /dev/ptmx +py_cv_dev_ptmx=none +case $host in + *-*-linux*) py_cv_dev_ptmx=skip;; #linux has openpty +esac +if test "x$cross_compiling" = xyes && test $py_cv_dev_ptmx != skip; then + AC_MSG_WARN([cross compiling: skip /dev/ptmx test]) + py_cv_dev_ptmx=skip +fi +if test $py_cv_dev_ptmx != skip; then + AC_CHECK_FILE("/dev/ptmx", + [py_cv_dev_ptmx=yes], + [py_cv_dev_ptmx=no], + ) +fi +if test "x$py_cv_dev_ptmx" = xyes; then AC_DEFINE(HAVE_DEV_PTMX, 1, - [Define if we have /dev/ptmx.]) -else - AC_MSG_RESULT(no) + [Define to 1 if you have the /dev/ptmx device file.]) fi -AC_MSG_CHECKING(for /dev/ptc) - -if test -r /dev/ptc -then - AC_MSG_RESULT(yes) +#check for /dev/ptc +py_cv_dev_ptc=none +if test "x$cross_compiling" = xyes && test $py_cv_dev_ptc != skip; then + AC_MSG_WARN([cross compiling: skip /dev/ptc test]) + py_cv_dev_ptc=skip +fi +if test $py_cv_dev_ptc != skip; then + AC_CHECK_FILE("/dev/ptc", + [py_cv_dev_ptc=yes], + [py_cv_dev_ptc=no], + ) +fi +if test "x$py_cv_dev_ptc" = xyes; then AC_DEFINE(HAVE_DEV_PTC, 1, - [Define if we have /dev/ptc.]) -else - AC_MSG_RESULT(no) + [Define to 1 if you have the /dev/ptc device file.]) fi AC_MSG_CHECKING(for %zd printf() format support) -AC_TRY_RUN([#include +AC_RUN_IFELSE([AC_LANG_SOURCE([[ +#include #include #include @@ -3659,10 +3753,13 @@ return 1; return 0; -}], +}]])], [AC_MSG_RESULT(yes) AC_DEFINE(PY_FORMAT_SIZE_T, "z", [Define to printf format modifier for Py_ssize_t])], - AC_MSG_RESULT(no)) + AC_MSG_RESULT(no), +[case $host in + *) AC_MSG_RESULT(cross-compiling, unknown);; +esac]) AC_CHECK_TYPE(socklen_t,, AC_DEFINE(socklen_t,int, @@ -3693,35 +3790,25 @@ AC_MSG_RESULT(done) # generate output files -AC_CONFIG_FILES(Makefile.pre Modules/Setup.config) -AC_OUTPUT - -echo "creating Modules/Setup" +AC_CONFIG_COMMANDS_PRE([ +AC_MSG_NOTICE([creating Modules/Setup]) if test ! -f Modules/Setup then cp $srcdir/Modules/Setup.dist Modules/Setup fi -echo "creating Modules/Setup.local" +AC_MSG_NOTICE([creating Modules/Setup.local]) if test ! -f Modules/Setup.local then echo "# Edit this file for local setup changes" >Modules/Setup.local -fi +fi]) -echo "creating Makefile" -$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ +AC_CONFIG_COMMANDS([Makefile], +[$SHELL $srcdir/Modules/makesetup -c $srcdir/Modules/config.c.in \ -s Modules Modules/Setup.config \ Modules/Setup.local Modules/Setup -case $ac_sys_system in -BeOS) - AC_MSG_WARN([ - - Support for BeOS is deprecated as of Python 2.6. - See PEP 11 for the gory details. - ]) - ;; -*) ;; -esac +mv config.c Modules]) -mv config.c Modules +AC_CONFIG_FILES(Makefile.pre Modules/Setup.config) +AC_OUTPUT --- ./pyconfig.h.in.CROSS 2008-08-28 00:25:31.000000000 +0300 +++ ./pyconfig.h.in 2008-09-01 23:42:26.000000000 +0300 @@ -15,6 +15,12 @@ /* Define this if you have BeOS threads. */ #undef BEOS_THREADS +/* Define to 1 if you `chflags' function is broken. */ +#undef BROKEN_CHFLAGS + +/* Define to 1 if you `lchflags' function is broken. */ +#undef BROKEN_LCHFLAGS + /* Define if you have the Mach cthreads package */ #undef C_THREADS @@ -122,10 +128,10 @@ /* Define to 1 if you have the device macros. */ #undef HAVE_DEVICE_MACROS -/* Define if we have /dev/ptc. */ +/* Define to 1 if you have the /dev/ptc device file. */ #undef HAVE_DEV_PTC -/* Define if we have /dev/ptmx. */ +/* Define to 1 if you have the /dev/ptmx device file. */ #undef HAVE_DEV_PTMX /* Define to 1 if you have the header file. */ --- ./Modules/posixmodule.c.CROSS 2008-08-18 22:39:27.000000000 +0300 +++ ./Modules/posixmodule.c 2008-08-25 00:36:20.000000000 +0300 @@ -1772,7 +1772,7 @@ #endif /* HAVE_LCHMOD */ -#ifdef HAVE_CHFLAGS +#if defined(HAVE_CHFLAGS) && !defined(BROKEN_CHFLAGS) PyDoc_STRVAR(posix_chflags__doc__, "chflags(path, flags)\n\n\ Set file flags."); @@ -1797,7 +1797,7 @@ } #endif /* HAVE_CHFLAGS */ -#ifdef HAVE_LCHFLAGS +#if defined(HAVE_LCHFLAGS) && !defined(BROKEN_LCHFLAGS) PyDoc_STRVAR(posix_lchflags__doc__, "lchflags(path, flags)\n\n\ Set file flags.\n\