--- ./Lib/distutils/README.CROSS 2009-03-12 22:24:37.000000000 +0200 +++ ./Lib/distutils/README 2010-01-27 23:21:26.000000000 +0200 @@ -9,5 +9,10 @@ http://www.python.org/sigs/distutils-sig/ WARNING : Distutils must remain compatible with 2.3 +NOTE: After "Revision 77704 : taking sysconfig out of distutils" +Distutils package is not compatible with versions before 2.7a3. +Although "Revision 77759 : reintroduced the names in Distutils for APIs +that were relocated"(i.e. API is backward compatibile) to cross compile +python on build system has to be at least version 2.7a3. $Id: README 70017 2009-02-27 12:53:34Z tarek.ziade $ --- ./Makefile.pre.in.CROSS 2010-04-13 21:58:41.000000000 +0300 +++ ./Makefile.pre.in 2010-05-16 14:26:16.000000000 +0300 @@ -184,6 +184,10 @@ PROFILE_TASK= $(srcdir)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py +# Don't define HOST_OS as makefile macro ! +@CROSS_ON@RUNPYTHON= HOST_OS=@HOST_OS@ @SYSPYTHON@ +@CROSS_OFF@RUNPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) + # === Definitions added by makesetup === @@ -397,15 +401,16 @@ Modules/python.o \ $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) +# FIXME: next produce incorrect result if cross-compiling platform: $(BUILDPYTHON) - $(RUNSHARED) ./$(BUILDPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform + $(RUNPYTHON) -E -c 'import sys ; from sysconfig import get_platform ; print get_platform()+"-"+sys.version[0:3]' >platform # Build the shared modules sharedmods: $(BUILDPYTHON) @case $$MAKEFLAGS in \ - *s*) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py -q build;; \ - *) $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' ./$(BUILDPYTHON) -E $(srcdir)/setup.py build;; \ + *s*) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(RUNPYTHON) -E $(srcdir)/setup.py -q build;; \ + *) CC='$(CC)' LDSHARED='$(BLDSHARED)' LDFLAGS='$(LDFLAGS)' OPT='$(OPT)' $(RUNPYTHON) -E $(srcdir)/setup.py build;; \ esac # Build static library @@ -493,12 +498,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." @@ -536,6 +536,7 @@ $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c +# FIXME: next may fail in cross-compilation environment $(GRAMMAR_H) $(GRAMMAR_C): $(PGEN) $(GRAMMAR_INPUT) -@$(INSTALL) -d Include -$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) @@ -702,6 +703,7 @@ TESTOPTS= -l $(EXTRATESTOPTS) TESTPROG= $(srcdir)/Lib/test/regrtest.py +# FIXME: next test may fail in cross-compilation environment TESTPYTHON= $(RUNSHARED) ./$(BUILDPYTHON) -Wd -3 -E -tt test: all platform -find $(srcdir)/Lib -name '*.py[co]' -print | xargs rm -f @@ -919,26 +921,26 @@ done; \ done $(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - ./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ + PYTHONPATH=$(DESTDIR)$(LIBDEST) \ + $(RUNPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ $(DESTDIR)$(LIBDEST) - PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - ./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ + PYTHONPATH=$(DESTDIR)$(LIBDEST) \ + $(RUNPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST) -f \ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ $(DESTDIR)$(LIBDEST) - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - ./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ + -PYTHONPATH=$(DESTDIR)$(LIBDEST) \ + $(RUNPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - ./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ + -PYTHONPATH=$(DESTDIR)$(LIBDEST) \ + $(RUNPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ -d $(LIBDEST)/site-packages -f \ -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages - -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ - ./$(BUILDPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" + -PYTHONPATH=$(DESTDIR)$(LIBDEST) \ + $(RUNPYTHON) -Wi -t -c "import lib2to3.pygram, lib2to3.patcomp;lib2to3.patcomp.PatternCompiler()" # Create the PLATDIR source directory, if one wasn't distributed.. $(srcdir)/Lib/$(PLATDIR): @@ -1043,7 +1045,7 @@ # Install the dynamically loadable modules # This goes into $(exec_prefix) sharedinstall: - $(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ + $(RUNPYTHON) -E $(srcdir)/setup.py install \ --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ --install-platlib=$(DESTSHARED) \ @@ -1081,7 +1083,7 @@ fi; \ done $(LN) -fsn include/python$(VERSION) $(DESTDIR)$(prefix)/Headers - sed 's/%VERSION%/'"`$(RUNSHARED) ./$(BUILDPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist + sed 's/%VERSION%/'"`$(RUNPYTHON) -c 'import platform; print platform.python_version()'`"'/g' < $(RESSRCDIR)/Info.plist > $(DESTDIR)$(prefix)/Resources/Info.plist $(LN) -fsn $(VERSION) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Versions/Current $(LN) -fsn Versions/Current/$(PYTHONFRAMEWORK) $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/$(PYTHONFRAMEWORK) $(LN) -fsn Versions/Current/Headers $(DESTDIR)$(PYTHONFRAMEWORKINSTALLDIR)/Headers @@ -1115,20 +1117,19 @@ # This installs a few of the useful scripts in Tools/scripts scriptsinstall: - SRCDIR=$(srcdir) $(RUNSHARED) \ - ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ + SRCDIR=$(srcdir) \ + $(RUNPYTHON) $(srcdir)/Tools/scripts/setup.py install \ --prefix=$(prefix) \ --install-scripts=$(BINDIR) \ --root=/$(DESTDIR) # Build the toplevel Makefile Makefile.pre: Makefile.pre.in config.status - CONFIG_FILES=Makefile.pre CONFIG_HEADERS= $(SHELL) config.status - $(MAKE) -f Makefile.pre Makefile + $(SHELL) ./config.status $@ # Run the configure script. config.status: $(srcdir)/configure - $(SHELL) $(srcdir)/configure $(CONFIG_ARGS) + $(SHELL) ./config.status --recheck .PRECIOUS: config.status $(BUILDPYTHON) Makefile Makefile.pre @@ -1143,8 +1144,8 @@ # Rerun configure with the same options as it was run last time, # provided the config.status script exists recheck: - $(SHELL) config.status --recheck - $(SHELL) config.status + $(SHELL) ./config.status --recheck + $(SHELL) ./config.status # Rebuild the configure script from configure.in; also rebuild pyconfig.h.in autoconf: @@ -1238,7 +1239,7 @@ # Perform some verification checks on any modified files. patchcheck: - $(RUNSHARED) ./$(BUILDPYTHON) $(srcdir)/Tools/scripts/patchcheck.py + $(RUNPYTHON) $(srcdir)/Tools/scripts/patchcheck.py # Dependencies --- ./setup.py.CROSS 2010-05-09 21:10:54.000000000 +0300 +++ ./setup.py 2010-05-16 13:54:28.000000000 +0300 @@ -258,6 +258,10 @@ self.announce('WARNING: skipping import check for Cygwin-based "%s"' % ext.name) return + if os.environ.get('HOST_OS') is not None: + self.announce('WARNING: skipping import check for cross-compiled "%s"' + % ext.name) + return ext_filename = os.path.join( self.build_lib, self.get_ext_filename(self.get_ext_fullname(ext.name))) @@ -293,11 +297,15 @@ self.failed.append(ext.name) def get_platform(self): - # Get value of sys.platform + # Get value of host platform (set only if cross-compile) + # otherwise value of sys.platform + host_os = os.environ.get('HOST_OS') + if host_os is None: + host_os = sys.platform for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']: - if sys.platform.startswith(platform): + if host_os.startswith(platform): return platform - return sys.platform + return host_os def detect_modules(self): # Ensure that /usr/local is always used @@ -310,6 +318,9 @@ # directly since an inconsistently reproducible issue comes up where # the environment variable is not set even though the value were passed # into configure and stored in the Makefile (issue found on OS X 10.3). + # NOTE: In cross-compilation environment python for build system + # is linked in top build directory under name syspython to get + # above to work (distutils hack). for env_var, arg_name, dir_list in ( ('LDFLAGS', '-R', self.compiler.runtime_library_dirs), ('LDFLAGS', '-L', self.compiler.library_dirs), @@ -943,7 +954,7 @@ '_sqlite/util.c', ] sqlite_defines = [] - if sys.platform != "win32": + if platform != "win32": sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) else: sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) @@ -951,7 +962,7 @@ # Comment this out if you want the sqlite3 module to be able to load extensions. sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1")) - if sys.platform == 'darwin': + if platform == 'darwin': # In every directory on the search path search for a dynamic # library and then a static library, instead of first looking # for dynamic libraries on the entiry path. @@ -1172,7 +1183,7 @@ break if version >= version_req: if (self.compiler.find_library_file(lib_dirs, 'z')): - if sys.platform == "darwin": + if platform == "darwin": zlib_extra_link_args = ('-Wl,-search_paths_first',) else: zlib_extra_link_args = () @@ -1204,7 +1215,7 @@ # Gustavo Niemeyer's bz2 module. if (self.compiler.find_library_file(lib_dirs, 'bz2')): - if sys.platform == "darwin": + if platform == "darwin": bz2_extra_link_args = ('-Wl,-search_paths_first',) else: bz2_extra_link_args = () @@ -1580,7 +1591,7 @@ # Check for the include files on Debian and {Free,Open}BSD, where # they're put in /usr/include/{tcl,tk}X.Y dotversion = version - if '.' not in dotversion and "bsd" in sys.platform.lower(): + if '.' not in dotversion and "bsd" in platform.lower(): # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, # but the include subdirs are named like .../include/tcl8.3. dotversion = dotversion[:-1] + '.' + dotversion[-1] @@ -1696,8 +1707,9 @@ return True def configure_ctypes(self, ext): + platform = self.get_platform() if not self.use_system_libffi: - if sys.platform == 'darwin': + if platform == 'darwin': return self.configure_ctypes_darwin(ext) srcdir = sysconfig.get_config_var('srcdir') @@ -1715,12 +1727,17 @@ ffi_configfile): from distutils.dir_util import mkpath mkpath(ffi_builddir) - config_args = [] + #NOTE: best solution is to add to configure script + # as config subdirectory and to exclude darwin + # (see configure_ctypes_darwin). + #FIXME: lets for now pass all top configure arguments + #and do not modify configure script. + config_args = sysconfig.get_config_var("CONFIG_ARGS") # Pass empty CFLAGS because we'll just append the resulting # CFLAGS to Python's; -g or -O2 is to be avoided. cmd = "cd %s && env CFLAGS='' '%s/configure' %s" \ - % (ffi_builddir, ffi_srcdir, " ".join(config_args)) + % (ffi_builddir, ffi_srcdir, config_args) res = os.system(cmd) if res or not os.path.exists(ffi_configfile): @@ -1758,14 +1775,15 @@ '_ctypes/malloc_closure.c'] depends = ['_ctypes/ctypes.h'] - if sys.platform == 'darwin': + platform = self.get_platform() + if platform == 'darwin': sources.append('_ctypes/darwin/dlfcn_simple.c') extra_compile_args.append('-DMACOSX') include_dirs.append('_ctypes/darwin') # XXX Is this still needed? ## extra_link_args.extend(['-read_only_relocs', 'warning']) - elif sys.platform == 'sunos5': + elif platform == 'sunos5': # XXX This shouldn't be necessary; it appears that some # of the assembler code is non-PIC (i.e. it has relocations # when it shouldn't. The proper fix would be to rewrite @@ -1776,7 +1794,7 @@ # finding some -z option for the Sun compiler. extra_link_args.append('-mimpure-text') - elif sys.platform.startswith('hp-ux'): + elif platform.startswith('hp-ux'): extra_link_args.append('-fPIC') ext = Extension('_ctypes', @@ -1793,7 +1811,7 @@ if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): return - if sys.platform == 'darwin': + if platform == 'darwin': # OS X 10.5 comes with libffi.dylib; the include files are # in /usr/include/ffi inc_dirs.append('/usr/include/ffi') --- ./configure.in.CROSS 2010-05-11 22:16:23.000000000 +0300 +++ ./configure.in 2010-05-16 14:32:27.000000000 +0300 @@ -18,6 +18,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 @@ -49,6 +50,46 @@ 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) + +AC_PROG_LN_S +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 + SYSPYOSNAME=`${SYSPYTHON} -c "import os; print os.name"` + case $SYSPYOSNAME in + posix) + dnl On posix distutils read variables from installed makefile. + dnl We will do some hacks based on distutils internals to overcome + dnl this limitation: + dnl - we link system python in build directory so that it will + dnl read generated file. + dnl As result from sysconfig.get_config_vars we will get our + dnl setting (for the host system) like SO, CFLAGS, CPPFLAGS, + dnl LDFLAGS instead those for the build system. + rm -f syspython + ${LN_S} ${SYSPYTHON} syspython + SYSPYTHON=./syspython + esac +fi + AC_SUBST(VERSION) VERSION=PYTHON_VERSION @@ -282,8 +323,35 @@ ## [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". if test -z "$MACHDEP" then ac_sys_system=`uname -s` @@ -300,14 +368,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 @@ -469,10 +541,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 @@ -598,6 +666,13 @@ AC_USE_SYSTEM_EXTENSIONS # 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. @@ -751,22 +826,23 @@ AC_MSG_CHECKING(for --enable-profiling) AC_ARG_ENABLE(profiling, - AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]), -[ac_save_cc="$CC" - CC="$CC -pg" - AC_RUN_IFELSE([AC_LANG_SOURCE([[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 + AS_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) @@ -854,8 +930,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) @@ -992,7 +1067,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" ;; @@ -2701,7 +2776,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 \ @@ -3102,7 +3181,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 @@ -3610,6 +3689,7 @@ fi # 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_RUN_IFELSE([AC_LANG_SOURCE([[ @@ -3644,6 +3724,7 @@ AC_DEFINE(HAVE_BROKEN_SEM_GETVALUE, 1, [define to 1 if your sem_getvalue is broken.]) fi +fi # determine what size digit to use for Python's longs AC_MSG_CHECKING([digit size for Python's longs]) @@ -4125,26 +4206,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 @@ -4276,35 +4365,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 2010-05-12 01:29:47.000000000 +0300 +++ ./pyconfig.h.in 2010-05-12 01:29:51.000000000 +0300 @@ -152,10 +152,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. */