Commit d65e2bab authored by doko@python.org's avatar doko@python.org

- Issue #17086: Backport the patches from the 3.3 branch to cross-build

  the package.
parent c5200b48
...@@ -37,6 +37,11 @@ if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower(): ...@@ -37,6 +37,11 @@ if os.name == "nt" and "\\pcbuild\\amd64" in project_base[-14:].lower():
project_base = os.path.abspath(os.path.join(project_base, os.path.pardir, project_base = os.path.abspath(os.path.join(project_base, os.path.pardir,
os.path.pardir)) os.path.pardir))
# set for cross builds
if "_PYTHON_PROJECT_BASE" in os.environ:
# this is the build directory, at least for posix
project_base = os.path.normpath(os.environ["_PYTHON_PROJECT_BASE"])
# python_build: (Boolean) if true, we're either building Python or # python_build: (Boolean) if true, we're either building Python or
# building an extension with an un-installed Python, so we use # building an extension with an un-installed Python, so we use
# different (hard-wired) directories. # different (hard-wired) directories.
...@@ -230,7 +235,7 @@ def get_config_h_filename(): ...@@ -230,7 +235,7 @@ def get_config_h_filename():
def get_makefile_filename(): def get_makefile_filename():
"""Return full pathname of installed Makefile from the Python build.""" """Return full pathname of installed Makefile from the Python build."""
if python_build: if python_build:
return os.path.join(os.path.dirname(sys.executable), "Makefile") return os.path.join(project_base, "Makefile")
lib_dir = get_python_lib(plat_specific=1, standard_lib=1) lib_dir = get_python_lib(plat_specific=1, standard_lib=1)
return os.path.join(lib_dir, "config", "Makefile") return os.path.join(lib_dir, "config", "Makefile")
......
...@@ -51,6 +51,10 @@ def get_platform (): ...@@ -51,6 +51,10 @@ def get_platform ():
return 'win-ia64' return 'win-ia64'
return sys.platform return sys.platform
# Set for cross builds explicitly
if "_PYTHON_HOST_PLATFORM" in os.environ:
return os.environ["_PYTHON_HOST_PLATFORM"]
if os.name != "posix" or not hasattr(os, 'uname'): if os.name != "posix" or not hasattr(os, 'uname'):
# XXX what about the architecture? NT is Intel or Alpha, # XXX what about the architecture? NT is Intel or Alpha,
# Mac OS is M68k or PPC, etc. # Mac OS is M68k or PPC, etc.
......
#! /bin/sh #! /bin/sh
set -v set -v
python$EXE ../../Tools/scripts/h2py.py -i '(u_long)' /usr/include/netinet/in.h eval $PYTHON_FOR_BUILD ../../Tools/scripts/h2py.py -i "'(u_long)'" /usr/include/netinet/in.h
...@@ -116,6 +116,10 @@ if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower(): ...@@ -116,6 +116,10 @@ if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower():
if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower(): if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower():
_PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir))
# set for cross builds
if "_PYTHON_PROJECT_BASE" in os.environ:
# the build directory for posix builds
_PROJECT_BASE = os.path.normpath(os.path.abspath("."))
def is_python_build(): def is_python_build():
for fn in ("Setup.dist", "Setup.local"): for fn in ("Setup.dist", "Setup.local"):
if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)): if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)):
...@@ -507,6 +511,10 @@ def get_platform(): ...@@ -507,6 +511,10 @@ def get_platform():
return 'win-ia64' return 'win-ia64'
return sys.platform return sys.platform
# Set for cross builds explicitly
if "_PYTHON_HOST_PLATFORM" in os.environ:
return os.environ["_PYTHON_HOST_PLATFORM"]
if os.name != "posix" or not hasattr(os, 'uname'): if os.name != "posix" or not hasattr(os, 'uname'):
# XXX what about the architecture? NT is Intel or Alpha, # XXX what about the architecture? NT is Intel or Alpha,
# Mac OS is M68k or PPC, etc. # Mac OS is M68k or PPC, etc.
......
...@@ -29,6 +29,8 @@ srcdir= @srcdir@ ...@@ -29,6 +29,8 @@ srcdir= @srcdir@
VPATH= @srcdir@ VPATH= @srcdir@
abs_srcdir= @abs_srcdir@ abs_srcdir= @abs_srcdir@
abs_builddir= @abs_builddir@ abs_builddir= @abs_builddir@
build= @build@
host= @host@
CC= @CC@ CC= @CC@
CXX= @CXX@ CXX= @CXX@
...@@ -190,6 +192,10 @@ UNICODE_OBJS= @UNICODE_OBJS@ ...@@ -190,6 +192,10 @@ UNICODE_OBJS= @UNICODE_OBJS@
PYTHON= python$(EXE) PYTHON= python$(EXE)
BUILDPYTHON= python$(BUILDEXE) BUILDPYTHON= python$(BUILDEXE)
PYTHON_FOR_BUILD=@PYTHON_FOR_BUILD@
_PYTHON_HOST_PLATFORM=@_PYTHON_HOST_PLATFORM@
HOST_GNU_TYPE= @host@
# The task to run while instrument when building the profile-opt target # 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)/Tools/pybench/pybench.py -n 2 --with-gc --with-syscheck
#PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py #PROFILE_TASK= $(srcdir)/Lib/test/regrtest.py
...@@ -222,6 +228,19 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@ ...@@ -222,6 +228,19 @@ LIBFFI_INCLUDEDIR= @LIBFFI_INCLUDEDIR@
# Parser # Parser
PGEN= Parser/pgen$(EXE) PGEN= Parser/pgen$(EXE)
PSRCS= \
Parser/acceler.c \
Parser/grammar1.c \
Parser/listnode.c \
Parser/node.c \
Parser/parser.c \
Parser/parsetok.c \
Parser/bitset.c \
Parser/metagrammar.c \
Parser/firstsets.c \
Parser/grammar.c \
Parser/pgen.c
POBJS= \ POBJS= \
Parser/acceler.o \ Parser/acceler.o \
Parser/grammar1.o \ Parser/grammar1.o \
...@@ -237,6 +256,14 @@ POBJS= \ ...@@ -237,6 +256,14 @@ POBJS= \
PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o PARSER_OBJS= $(POBJS) Parser/myreadline.o Parser/tokenizer.o
PGSRCS= \
Objects/obmalloc.c \
Python/mysnprintf.c \
Python/pyctype.c \
Parser/tokenizer_pgen.c \
Parser/printgrammar.c \
Parser/pgenmain.c
PGOBJS= \ PGOBJS= \
Objects/obmalloc.o \ Objects/obmalloc.o \
Python/mysnprintf.o \ Python/mysnprintf.o \
...@@ -249,7 +276,8 @@ PARSER_HEADERS= \ ...@@ -249,7 +276,8 @@ PARSER_HEADERS= \
Parser/parser.h \ Parser/parser.h \
Parser/tokenizer.h Parser/tokenizer.h
PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS) PGENSRCS= $(PSRCS) $(PGSRCS)
PGENOBJS= $(POBJS) $(PGOBJS)
########################################################################## ##########################################################################
# AST # AST
...@@ -391,6 +419,7 @@ build_all_generate_profile: ...@@ -391,6 +419,7 @@ build_all_generate_profile:
$(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov" $(MAKE) all CFLAGS="$(CFLAGS) -fprofile-generate" LIBS="$(LIBS) -lgcov"
run_profile_task: run_profile_task:
: # FIXME: can't run for a cross build
./$(BUILDPYTHON) $(PROFILE_TASK) ./$(BUILDPYTHON) $(PROFILE_TASK)
build_all_use_profile: build_all_use_profile:
...@@ -409,7 +438,7 @@ $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) ...@@ -409,7 +438,7 @@ $(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY)
$(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST)
platform: $(BUILDPYTHON) platform: $(BUILDPYTHON)
$(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
# Build the shared modules # Build the shared modules
...@@ -422,7 +451,7 @@ sharedmods: $(BUILDPYTHON) ...@@ -422,7 +451,7 @@ sharedmods: $(BUILDPYTHON)
*) quiet="";; \ *) quiet="";; \
esac; \ esac; \
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \ $(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
./$(BUILDPYTHON) -E $(srcdir)/setup.py $$quiet build $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build
# Build static library # Build static library
# avoid long command lines, same as LIBRARY_OBJS # avoid long command lines, same as LIBRARY_OBJS
...@@ -551,12 +580,13 @@ Modules/python.o: $(srcdir)/Modules/python.c ...@@ -551,12 +580,13 @@ Modules/python.o: $(srcdir)/Modules/python.c
$(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c $(MAINCC) -c $(PY_CFLAGS) -o $@ $(srcdir)/Modules/python.c
# Use a stamp file to prevent make -j invoking pgen twice $(GRAMMAR_H): $(GRAMMAR_INPUT) $(PGENSRCS)
$(GRAMMAR_H) $(GRAMMAR_C): Parser/pgen.stamp @$(MKDIR_P) Include
Parser/pgen.stamp: $(PGEN) $(GRAMMAR_INPUT) $(MAKE) $(PGEN)
-@$(INSTALL) -d Include
$(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C) $(PGEN) $(GRAMMAR_INPUT) $(GRAMMAR_H) $(GRAMMAR_C)
-touch Parser/pgen.stamp $(GRAMMAR_C): $(GRAMMAR_H) $(GRAMMAR_INPUT) $(PGENSRCS)
$(MAKE) $(GRAMMAR_H)
touch $(GRAMMAR_C)
$(PGEN): $(PGENOBJS) $(PGEN): $(PGENOBJS)
$(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN) $(CC) $(OPT) $(LDFLAGS) $(PGENOBJS) $(LIBS) -o $(PGEN)
...@@ -953,37 +983,43 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c ...@@ -953,37 +983,43 @@ libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
$(DESTDIR)$(LIBDEST)/distutils/tests ; \ $(DESTDIR)$(LIBDEST)/distutils/tests ; \
fi fi
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \ $(PYTHON_FOR_BUILD) -Wi -tt $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \ -d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST) $(DESTDIR)$(LIBDEST)
PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \ $(PYTHON_FOR_BUILD) -Wi -tt -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST) -f \ -d $(LIBDEST) -f \
-x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \ -x 'bad_coding|badsyntax|site-packages|lib2to3/tests/data' \
$(DESTDIR)$(LIBDEST) $(DESTDIR)$(LIBDEST)
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \ $(PYTHON_FOR_BUILD) -Wi -t $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \ -d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \ $(PYTHON_FOR_BUILD) -Wi -t -O $(DESTDIR)$(LIBDEST)/compileall.py \
-d $(LIBDEST)/site-packages -f \ -d $(LIBDEST)/site-packages -f \
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \ -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
./$(BUILDPYTHON) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
# Create the PLATDIR source directory, if one wasn't distributed.. # Create the PLATDIR source directory, if one wasn't distributed..
$(srcdir)/Lib/$(PLATDIR): $(srcdir)/Lib/$(PLATDIR):
mkdir $(srcdir)/Lib/$(PLATDIR) mkdir $(srcdir)/Lib/$(PLATDIR)
cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen cp $(srcdir)/Lib/plat-generic/regen $(srcdir)/Lib/$(PLATDIR)/regen
export PATH; PATH="`pwd`:$$PATH"; \ export PATH; PATH="`pwd`:$$PATH"; \
export PYTHONPATH; PYTHONPATH="`pwd`/Lib"; \ export PYTHONPATH; PYTHONPATH="$(srcdir)/Lib:$(abs_builddir)/`cat pybuilddir.txt`"; \
export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \ export DYLD_FRAMEWORK_PATH; DYLD_FRAMEWORK_PATH="`pwd`"; \
export EXE; EXE="$(BUILDEXE)"; \ export EXE; EXE="$(BUILDEXE)"; \
if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \ if [ -n "$(MULTIARCH)" ]; then export MULTIARCH; MULTIARCH=$(MULTIARCH); fi; \
export PYTHON_FOR_BUILD; \
if [ "$(build)" = "$(host)" ]; then \
PYTHON_FOR_BUILD="$(BUILDPYTHON)"; \
else \
PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)"; \
fi; \
cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen cd $(srcdir)/Lib/$(PLATDIR); $(RUNSHARED) ./regen
python-config: $(srcdir)/Misc/python-config.in python-config: $(srcdir)/Misc/python-config.in
...@@ -1079,7 +1115,7 @@ libainstall: all python-config ...@@ -1079,7 +1115,7 @@ libainstall: all python-config
# Install the dynamically loadable modules # Install the dynamically loadable modules
# This goes into $(exec_prefix) # This goes into $(exec_prefix)
sharedinstall: sharedmods sharedinstall: sharedmods
$(RUNSHARED) ./$(BUILDPYTHON) -E $(srcdir)/setup.py install \ $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-scripts=$(BINDIR) \ --install-scripts=$(BINDIR) \
--install-platlib=$(DESTSHARED) \ --install-platlib=$(DESTSHARED) \
...@@ -1152,7 +1188,7 @@ frameworkinstallextras: ...@@ -1152,7 +1188,7 @@ frameworkinstallextras:
# This installs a few of the useful scripts in Tools/scripts # This installs a few of the useful scripts in Tools/scripts
scriptsinstall: scriptsinstall:
SRCDIR=$(srcdir) $(RUNSHARED) \ SRCDIR=$(srcdir) $(RUNSHARED) \
./$(BUILDPYTHON) $(srcdir)/Tools/scripts/setup.py install \ $(PYTHON_FOR_BUILD) $(srcdir)/Tools/scripts/setup.py install \
--prefix=$(prefix) \ --prefix=$(prefix) \
--install-scripts=$(BINDIR) \ --install-scripts=$(BINDIR) \
--root=$(DESTDIR)/ --root=$(DESTDIR)/
...@@ -1219,7 +1255,7 @@ profile-removal: ...@@ -1219,7 +1255,7 @@ profile-removal:
clobber: clean profile-removal clobber: clean profile-removal
-rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \ -rm -f $(BUILDPYTHON) $(PGEN) $(LIBRARY) $(LDLIBRARY) $(DLLLIBRARY) \
tags TAGS Parser/pgen.stamp \ tags TAGS \
config.cache config.log pyconfig.h Modules/config.c config.cache config.log pyconfig.h Modules/config.c
-rm -rf build platform -rm -rf build platform
-rm -rf $(PYTHONFRAMEWORKDIR) -rm -rf $(PYTHONFRAMEWORKDIR)
......
...@@ -754,6 +754,9 @@ Tests ...@@ -754,6 +754,9 @@ Tests
Build Build
----- -----
- Issue #17086: Backport the patches from the 3.3 branch to cross-build
the package.
- Issue #3754: fix typo in pthread AC_CACHE_VAL. - Issue #3754: fix typo in pthread AC_CACHE_VAL.
- Issue #17029: Let h2py search the multiarch system include directory. - Issue #17029: Let h2py search the multiarch system include directory.
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -12,6 +12,33 @@ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/) ...@@ -12,6 +12,33 @@ AC_INIT(python, PYTHON_VERSION, http://bugs.python.org/)
AC_CONFIG_SRCDIR([Include/object.h]) AC_CONFIG_SRCDIR([Include/object.h])
AC_CONFIG_HEADER(pyconfig.h) AC_CONFIG_HEADER(pyconfig.h)
AC_CANONICAL_HOST
AC_SUBST(build)
AC_SUBST(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 python2 python; do
which $interp >/dev/null 2>&1 || continue
if $interp -c 'import sys;sys.exit(not (sys.version_info@<:@:2@:>@ >= (2,7) and sys.version_info@<:@0@:>@ < 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='_PYTHON_PROJECT_BASE=$(abs_builddir) _PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) PYTHONPATH=$(shell test -f pybuilddir.txt && echo $(abs_builddir)/`cat pybuilddir.txt`:)$(srcdir)/Lib:$(srcdir)/Lib/plat-$(MACHDEP) '$interp
fi
elif test "$cross_compiling" = maybe; then
AC_MSG_ERROR([Cross compiling required --host=HOST-TUPLE and --build=ARCH])
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 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 it does, we get path names containing '//' which is both ugly and
dnl can cause trouble. dnl can cause trouble.
...@@ -279,6 +306,25 @@ AC_SUBST(MACHDEP) ...@@ -279,6 +306,25 @@ AC_SUBST(MACHDEP)
AC_MSG_CHECKING(MACHDEP) AC_MSG_CHECKING(MACHDEP)
if test -z "$MACHDEP" if test -z "$MACHDEP"
then then
# avoid using uname for cross builds
if test "$cross_compiling" = yes; then
# ac_sys_system and ac_sys_release are only used for setting
# `define_xopen_source' in the case statement below. For the
# current supported cross builds, this macro is not adjusted.
case "$host" in
*-*-linux*)
ac_sys_system=Linux
;;
*-*-cygwin*)
ac_sys_system=Cygwin
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
AC_MSG_ERROR([cross build not supported for $host])
esac
ac_sys_release=
else
ac_sys_system=`uname -s` ac_sys_system=`uname -s`
if test "$ac_sys_system" = "AIX" \ if test "$ac_sys_system" = "AIX" \
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then -o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
...@@ -286,6 +332,7 @@ then ...@@ -286,6 +332,7 @@ then
else else
ac_sys_release=`uname -r` ac_sys_release=`uname -r`
fi fi
fi
ac_md_system=`echo $ac_sys_system | ac_md_system=`echo $ac_sys_system |
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
ac_md_release=`echo $ac_sys_release | ac_md_release=`echo $ac_sys_release |
...@@ -302,6 +349,29 @@ then ...@@ -302,6 +349,29 @@ then
esac esac
fi fi
AC_SUBST(_PYTHON_HOST_PLATFORM)
if test "$cross_compiling" = yes; then
case "$host" in
*-*-linux*)
case "$host_cpu" in
arm*)
_host_cpu=arm
;;
*)
_host_cpu=$host_cpu
esac
;;
*-*-cygwin*)
_host_cpu=
;;
*)
# for now, limit cross builds to known configurations
MACHDEP="unknown"
AC_MSG_ERROR([cross build not supported for $host])
esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
# disable features if it is defined, without any means to access these # disable features if it is defined, without any means to access these
# features as extensions. For these systems, we skip the definition of # features as extensions. For these systems, we skip the definition of
...@@ -446,10 +516,6 @@ AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET) ...@@ -446,10 +516,6 @@ AC_SUBST(EXPORT_MACOSX_DEPLOYMENT_TARGET)
CONFIGURE_MACOSX_DEPLOYMENT_TARGET= CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_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 # checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
...@@ -578,8 +644,8 @@ preset_cxx="$CXX" ...@@ -578,8 +644,8 @@ preset_cxx="$CXX"
if test -z "$CXX" if test -z "$CXX"
then then
case "$CC" in case "$CC" in
gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;; gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;; cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
esac esac
if test "$CXX" = "notfound" if test "$CXX" = "notfound"
then then
...@@ -588,7 +654,7 @@ then ...@@ -588,7 +654,7 @@ then
fi fi
if test -z "$CXX" if test -z "$CXX"
then then
AC_CHECK_PROGS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound) AC_CHECK_TOOLS(CXX, $CCC c++ g++ gcc CC cxx cc++ cl, notfound)
if test "$CXX" = "notfound" if test "$CXX" = "notfound"
then then
CXX="" CXX=""
...@@ -764,22 +830,23 @@ AC_MSG_RESULT($enable_shared) ...@@ -764,22 +830,23 @@ AC_MSG_RESULT($enable_shared)
AC_MSG_CHECKING(for --enable-profiling) AC_MSG_CHECKING(for --enable-profiling)
AC_ARG_ENABLE(profiling, AC_ARG_ENABLE(profiling,
AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]), AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
[ac_save_cc="$CC" if test "x$enable_profiling" = xyes; then
CC="$CC -pg" ac_save_cc="$CC"
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])], CC="$(CC) -pg"
[ac_enable_profiling="yes"], AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
[ac_enable_profiling="no"], [],
[ac_enable_profiling="no"]) [enable_profiling=no])
CC="$ac_save_cc"]) CC="$ac_save_cc"
AC_MSG_RESULT($ac_enable_profiling) else
enable_profiling=no
fi
AC_MSG_RESULT($enable_profiling)
case "$ac_enable_profiling" in if test "x$enable_profiling" = xyes; then
"yes")
BASECFLAGS="-pg $BASECFLAGS" BASECFLAGS="-pg $BASECFLAGS"
LDFLAGS="-pg $LDFLAGS" LDFLAGS="-pg $LDFLAGS"
;; fi
esac
AC_MSG_CHECKING(LDLIBRARY) AC_MSG_CHECKING(LDLIBRARY)
...@@ -868,11 +935,15 @@ else # shared is disabled ...@@ -868,11 +935,15 @@ else # shared is disabled
esac esac
fi fi
if test "$cross_compiling" = yes; then
RUNSHARED=
fi
AC_MSG_RESULT($LDLIBRARY) AC_MSG_RESULT($LDLIBRARY)
AC_PROG_RANLIB AC_PROG_RANLIB
AC_SUBST(AR) 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 # tweak ARFLAGS only if the user didn't set it on the command line
AC_SUBST(ARFLAGS) AC_SUBST(ARFLAGS)
...@@ -1046,7 +1117,7 @@ yes) ...@@ -1046,7 +1117,7 @@ yes)
# if using gcc on alpha, use -mieee to get (near) full IEEE 754 # if using gcc on alpha, use -mieee to get (near) full IEEE 754
# support. Without this, treatment of subnormals doesn't follow # support. Without this, treatment of subnormals doesn't follow
# the standard. # the standard.
case $ac_sys_machine in case $host in
alpha*) alpha*)
BASECFLAGS="$BASECFLAGS -mieee" BASECFLAGS="$BASECFLAGS -mieee"
;; ;;
...@@ -3216,7 +3287,12 @@ int main() ...@@ -3216,7 +3287,12 @@ int main()
]]])], ]]])],
[ac_cv_buggy_getaddrinfo=no], [ac_cv_buggy_getaddrinfo=no],
[ac_cv_buggy_getaddrinfo=yes], [ac_cv_buggy_getaddrinfo=yes],
[ac_cv_buggy_getaddrinfo=yes])) [
if test "${enable_ipv6+set}" = set; then
ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
else
ac_cv_buggy_getaddrinfo=yes
fi]))
fi fi
AC_MSG_RESULT($ac_cv_buggy_getaddrinfo) AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
...@@ -4246,26 +4322,31 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm ...@@ -4246,26 +4322,31 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <curses.h>]], [[void *x=resizeterm
[AC_MSG_RESULT(no)] [AC_MSG_RESULT(no)]
) )
AC_MSG_CHECKING(for /dev/ptmx) AC_MSG_NOTICE([checking for device files])
if test -r /dev/ptmx dnl NOTE: Inform user how to proceed with files when cross compiling.
then if test "x$cross_compiling" = xyes; then
AC_MSG_RESULT(yes) if test "${ac_cv_file__dev_ptmx+set}" != set; then
AC_DEFINE(HAVE_DEV_PTMX, 1, AC_MSG_CHECKING([for /dev/ptmx])
[Define if we have /dev/ptmx.]) AC_MSG_RESULT([not set])
else AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
AC_MSG_RESULT(no) 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 fi
AC_MSG_CHECKING(for /dev/ptc) AC_CHECK_FILE(/dev/ptmx, [], [])
if test "x$ac_cv_file__dev_ptmx" = xyes; then
if test -r /dev/ptc AC_DEFINE(HAVE_DEV_PTMX, 1,
then [Define to 1 if you have the /dev/ptmx device file.])
AC_MSG_RESULT(yes) fi
AC_CHECK_FILE(/dev/ptc, [], [])
if test "x$ac_cv_file__dev_ptc" = xyes; then
AC_DEFINE(HAVE_DEV_PTC, 1, AC_DEFINE(HAVE_DEV_PTC, 1,
[Define if we have /dev/ptc.]) [Define to 1 if you have the /dev/ptc device file.])
else
AC_MSG_RESULT(no)
fi fi
if test "$have_long_long" = yes if test "$have_long_long" = yes
...@@ -4305,7 +4386,23 @@ then ...@@ -4305,7 +4386,23 @@ then
]]])], ]]])],
[ac_cv_have_long_long_format=yes], [ac_cv_have_long_long_format=yes],
[ac_cv_have_long_long_format=no], [ac_cv_have_long_long_format=no],
[ac_cv_have_long_long_format=no]) [ac_cv_have_long_long_format="cross -- assuming no"
if test x$GCC = xyes; then
save_CFLAGS=$CFLAGS
CFLAGS="$CFLAGS -Werror -Wformat"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#include <stdio.h>
#include <stddef.h>
]], [[
char *buffer;
sprintf(buffer, "%lld", (long long)123);
sprintf(buffer, "%lld", (long long)-123);
sprintf(buffer, "%llu", (unsigned long long)123);
]])],
ac_cv_have_long_long_format=yes
)
CFLAGS=$save_CFLAGS
fi])
) )
AC_MSG_RESULT($ac_cv_have_long_long_format) AC_MSG_RESULT($ac_cv_have_long_long_format)
fi fi
......
...@@ -161,10 +161,10 @@ ...@@ -161,10 +161,10 @@
/* Define to 1 if you have the device macros. */ /* Define to 1 if you have the device macros. */
#undef HAVE_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 #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 #undef HAVE_DEV_PTMX
/* Define to 1 if you have the <direct.h> header file. */ /* Define to 1 if you have the <direct.h> header file. */
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment