--- ./Makefile.pre.in.CROSS 2009-10-28 00:28:35.000000000 +0200 +++ ./Makefile.pre.in 2009-10-28 00:28:45.000000000 +0200 @@ -477,12 +477,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." @@ -1110,7 +1105,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 2009-11-28 14:31:56.000000000 +0200 +++ ./configure.in 2009-11-28 14:32:05.000000000 +0200 @@ -19,6 +19,7 @@ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/) AC_CONFIG_SRCDIR([Include/object.h]) AC_CONFIG_HEADER(pyconfig.h) +AC_CANONICAL_HOST 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 @@ -50,6 +51,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 @@ -239,8 +264,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` @@ -257,14 +313,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 @@ -416,10 +476,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 @@ -538,6 +594,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. @@ -691,22 +754,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) @@ -794,8 +858,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) # tweak ARFLAGS only if the user didn't set it on the command line AC_SUBST(ARFLAGS) @@ -918,7 +981,7 @@ ac_save_cc="$CC" CC="$CC -fno-strict-aliasing" AC_CACHE_VAL(ac_cv_no_strict_aliasing_ok, - AC_TRY_COMPILE([],[int main() { return 0; }], + AC_COMPILE_IFELSE([AC_LANG_SOURCE([[]])], ac_cv_no_strict_aliasing_ok=yes, ac_cv_no_strict_aliasing_ok=no)) CC="$ac_save_cc" @@ -931,7 +994,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" ;; @@ -1066,10 +1129,9 @@ AC_CACHE_VAL(ac_cv_opt_olimit_ok, [ac_save_cc="$CC" CC="$CC -OPT:Olimit=0" -AC_TRY_COMPILE([],[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) if test $ac_cv_opt_olimit_ok = yes; then @@ -1088,10 +1150,9 @@ AC_CACHE_VAL(ac_cv_olimit_ok, [ac_save_cc="$CC" CC="$CC -Olimit 1500" - AC_TRY_COMPILE([],[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) if test $ac_cv_olimit_ok = yes; then @@ -2540,7 +2601,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 \ @@ -2952,7 +3017,7 @@ ac_cv_buggy_getaddrinfo=yes)) fi -if test $have_getaddrinfo = no -o $ac_cv_buggy_getaddrinfo = yes +if test $have_getaddrinfo = no || test $ac_cv_buggy_getaddrinfo = yes then if test $ipv6 = yes then @@ -3425,6 +3490,7 @@ # Multiprocessing check for broken sem_getvalue +if test $ac_cv_func_sem_getvalue = yes; then AC_MSG_CHECKING(for broken sem_getvalue) AC_CACHE_VAL(ac_cv_broken_sem_getvalue, AC_TRY_RUN([ @@ -3457,6 +3523,7 @@ AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, [define to 1 if your sem_getvalue is broken.]) fi +fi # On FreeBSD 6.2, it appears that tanh(-0.) returns 0. instead of # -0. on some architectures. @@ -3967,26 +4034,34 @@ AC_MSG_RESULT(no) ) -AC_MSG_CHECKING(for /dev/ptmx) +AC_MSG_NOTICE([checking for device files]) -if test -r /dev/ptmx -then - AC_MSG_RESULT(yes) - AC_DEFINE(HAVE_DEV_PTMX, 1, - [Define if we have /dev/ptmx.]) -else - AC_MSG_RESULT(no) +dnl NOTE: Inform user how to proceed with files when cross compiling. +if test "x$cross_compiling" = xyes; then + if test "${ac_cv_file__dev_ptmx+set}" != set; then + AC_MSG_CHECKING([for /dev/ptmx]) + AC_MSG_RESULT([not set]) + AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling]) + fi + if test "${ac_cv_file__dev_ptc+set}" != set; then + AC_MSG_CHECKING([for /dev/ptc]) + AC_MSG_RESULT([not set]) + AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling]) + fi fi -AC_MSG_CHECKING(for /dev/ptc) - -if test -r /dev/ptc -then - AC_MSG_RESULT(yes) +# FIXME: autoconf macro AC_CHECK_FILES is better but require additional +# changes in posixmodule.c : 's/HAVE_DEV_/HAVE__DEV_/g' +# To keep patch minimal I left defines as before. +AC_CHECK_FILE(/dev/ptmx, [], []) +if test "x$ac_cv_file__dev_ptmx" = xyes; then + AC_DEFINE(HAVE_DEV_PTMX, 1, + [Define to 1 if you have the /dev/ptmx device file.]) +fi +AC_CHECK_FILE(/dev/ptc, [], []) +if test "x$ac_cv_file__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 if test "$have_long_long" = yes @@ -4116,35 +4191,25 @@ AC_MSG_RESULT(done) # generate output files -AC_CONFIG_FILES(Makefile.pre Modules/Setup.config Misc/python.pc) -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 Misc/python.pc) +AC_OUTPUT --- ./pyconfig.h.in.CROSS 2009-11-28 14:51:04.000000000 +0200 +++ ./pyconfig.h.in 2009-11-28 14:51:12.000000000 +0200 @@ -149,10 +149,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. */