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

the package.
This commit is contained in:
doko@python.org 2013-01-31 23:52:03 +01:00
parent c5200b489d
commit d65e2bab3b
12 changed files with 4231 additions and 255 deletions

View file

@ -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():
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")

View file

@ -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.

View file

@ -1,3 +1,3 @@
#! /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

View file

@ -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():
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.

View file

@ -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@
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@
# 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= \
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= \
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:
$(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)
$(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)
*) 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
$(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
$(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
# 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:
# 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:
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)

View file

@ -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.

1530
config.guess vendored Normal file

File diff suppressed because it is too large Load diff

1782
config.sub vendored Normal file

File diff suppressed because it is too large Load diff

667
configure vendored
View file

@ -671,6 +671,7 @@ HGVERSION
BASECPPFLAGS BASECPPFLAGS
SVNVERSION SVNVERSION
ARFLAGS ARFLAGS
ac_ct_AR
AR AR
RANLIB RANLIB
GNULD GNULD
@ -687,6 +688,7 @@ EGREP
GREP GREP
CPP CPP
MULTIARCH MULTIARCH
ac_ct_CXX
MAINCC MAINCC
CXX CXX
OBJEXT OBJEXT
@ -701,6 +703,7 @@ CONFIGURE_MACOSX_DEPLOYMENT_TARGET
EXTRAMACHDEPPATH EXTRAMACHDEPPATH
EXTRAPLATDIR EXTRAPLATDIR
SGI_ABI SGI_ABI
_PYTHON_HOST_PLATFORM
MACHDEP MACHDEP
FRAMEWORKINSTALLAPPSPREFIX FRAMEWORKINSTALLAPPSPREFIX
FRAMEWORKUNIXTOOLSPREFIX FRAMEWORKUNIXTOOLSPREFIX
@ -719,6 +722,15 @@ UNIVERSALSDK
CONFIG_ARGS CONFIG_ARGS
SOVERSION SOVERSION
VERSION VERSION
PYTHON_FOR_BUILD
host_os
host_vendor
host_cpu
host
build_os
build_vendor
build_cpu
build
target_alias target_alias
host_alias host_alias
build_alias build_alias
@ -1397,6 +1409,10 @@ Fine tuning of the installation directories:
_ACEOF _ACEOF
cat <<\_ACEOF cat <<\_ACEOF
System types:
--build=BUILD configure for building on BUILD [guessed]
--host=HOST cross-compile to build programs to run on HOST [BUILD]
_ACEOF _ACEOF
fi fi
@ -2730,6 +2746,134 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
ac_config_headers="$ac_config_headers pyconfig.h" ac_config_headers="$ac_config_headers pyconfig.h"
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
$as_echo_n "checking build system type... " >&6; }
if ${ac_cv_build+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_build
shift
build_cpu=$1
build_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
build_os=$*
IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
$as_echo_n "checking host system type... " >&6; }
if ${ac_cv_host+:} false; then :
$as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
set x $ac_cv_host
shift
host_cpu=$1
host_vendor=$2
shift; shift
# Remember, the first character of IFS is used to create $*,
# except with old shells:
host_os=$*
IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
if test "$cross_compiling" = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for python interpreter for cross build" >&5
$as_echo_n "checking for python interpreter for cross build... " >&6; }
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
as_fn_error $? "python$PACKAGE_VERSION interpreter not found" "$LINENO" 5
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $interp" >&5
$as_echo "$interp" >&6; }
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
as_fn_error $? "Cross compiling required --host=HOST-TUPLE and --build=ARCH" "$LINENO" 5
else
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
fi
if test "$prefix" != "/"; then if test "$prefix" != "/"; then
prefix=`echo "$prefix" | sed -e 's/\/$//g'` prefix=`echo "$prefix" | sed -e 's/\/$//g'`
@ -3018,6 +3162,25 @@ fi
$as_echo_n "checking MACHDEP... " >&6; } $as_echo_n "checking MACHDEP... " >&6; }
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"
as_fn_error $? "cross build not supported for $host" "$LINENO" 5
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
@ -3025,20 +3188,44 @@ then
else else
ac_sys_release=`uname -r` ac_sys_release=`uname -r`
fi fi
ac_md_system=`echo $ac_sys_system | fi
tr -d '/ ' | tr '[A-Z]' '[a-z]'` ac_md_system=`echo $ac_sys_system |
ac_md_release=`echo $ac_sys_release | tr -d '/ ' | tr '[A-Z]' '[a-z]'`
tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//'` ac_md_release=`echo $ac_sys_release |
MACHDEP="$ac_md_system$ac_md_release" tr -d '/ ' | sed 's/^[A-Z]\.//' | sed 's/\..*//'`
MACHDEP="$ac_md_system$ac_md_release"
case $MACHDEP in case $MACHDEP in
linux*) MACHDEP="linux2";; linux*) MACHDEP="linux2";;
cygwin*) MACHDEP="cygwin";; cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";; darwin*) MACHDEP="darwin";;
atheos*) MACHDEP="atheos";; atheos*) MACHDEP="atheos";;
irix646) MACHDEP="irix6";; irix646) MACHDEP="irix6";;
'') MACHDEP="unknown";; '') MACHDEP="unknown";;
esac
fi
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"
as_fn_error $? "cross build not supported for $host" "$LINENO" 5
esac esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
@ -3195,12 +3382,6 @@ $as_echo "$EXTRAPLATDIR" >&6; }
CONFIGURE_MACOSX_DEPLOYMENT_TARGET= CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_MACOSX_DEPLOYMENT_TARGET='#' EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking machine type as reported by uname -m" >&5
$as_echo_n "checking machine type as reported by uname -m... " >&6; }
ac_sys_machine=`uname -m`
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_sys_machine" >&5
$as_echo "$ac_sys_machine" >&6; }
# 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
@ -4130,16 +4311,60 @@ preset_cxx="$CXX"
if test -z "$CXX" if test -z "$CXX"
then then
case "$CC" in case "$CC" in
gcc) # Extract the first word of "g++", so it can be a program name with args. gcc) if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}g++", so it can be a program name with args.
set dummy ${ac_tool_prefix}g++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $CXX in
[\\/]* | ?:[\\/]*)
ac_cv_path_CXX="$CXX" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in notfound
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
CXX=$ac_cv_path_CXX
if test -n "$CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
$as_echo "$CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_path_CXX"; then
ac_pt_CXX=$CXX
# Extract the first word of "g++", so it can be a program name with args.
set dummy g++; ac_word=$2 set dummy g++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CXX+:} false; then : if ${ac_cv_path_ac_pt_CXX+:} false; then :
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
case $CXX in case $ac_pt_CXX in
[\\/]* | ?:[\\/]*) [\\/]* | ?:[\\/]*)
ac_cv_path_CXX="$CXX" # Let the user override the test with a path. ac_cv_path_ac_pt_CXX="$ac_pt_CXX" # Let the user override the test with a path.
;; ;;
*) *)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@ -4149,7 +4374,7 @@ do
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_CXX="$as_dir/$ac_word$ac_exec_ext" ac_cv_path_ac_pt_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2 break 2
fi fi
@ -4157,22 +4382,36 @@ done
done done
IFS=$as_save_IFS IFS=$as_save_IFS
test -z "$ac_cv_path_CXX" && ac_cv_path_CXX="g++"
;; ;;
esac esac
fi fi
CXX=$ac_cv_path_CXX ac_pt_CXX=$ac_cv_path_ac_pt_CXX
if test -n "$CXX"; then if test -n "$ac_pt_CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CXX" >&5
$as_echo "$CXX" >&6; } $as_echo "$ac_pt_CXX" >&6; }
else else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi fi
if test "x$ac_pt_CXX" = x; then
CXX="g++"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_pt_CXX
fi
else
CXX="$ac_cv_path_CXX"
fi
;; ;;
cc) # Extract the first word of "c++", so it can be a program name with args. cc) if test -n "$ac_tool_prefix"; then
set dummy c++; ac_word=$2 # Extract the first word of "${ac_tool_prefix}c++", so it can be a program name with args.
set dummy ${ac_tool_prefix}c++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_CXX+:} false; then : if ${ac_cv_path_CXX+:} false; then :
@ -4198,7 +4437,6 @@ done
done done
IFS=$as_save_IFS IFS=$as_save_IFS
test -z "$ac_cv_path_CXX" && ac_cv_path_CXX="c++"
;; ;;
esac esac
fi fi
@ -4211,6 +4449,63 @@ else
$as_echo "no" >&6; } $as_echo "no" >&6; }
fi fi
fi
if test -z "$ac_cv_path_CXX"; then
ac_pt_CXX=$CXX
# Extract the first word of "c++", so it can be a program name with args.
set dummy c++; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_path_ac_pt_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
case $ac_pt_CXX in
[\\/]* | ?:[\\/]*)
ac_cv_path_ac_pt_CXX="$ac_pt_CXX" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in notfound
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_path_ac_pt_CXX="$as_dir/$ac_word$ac_exec_ext"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac
fi
ac_pt_CXX=$ac_cv_path_ac_pt_CXX
if test -n "$ac_pt_CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_CXX" >&5
$as_echo "$ac_pt_CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_pt_CXX" = x; then
CXX="c++"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_pt_CXX
fi
else
CXX="$ac_cv_path_CXX"
fi
;; ;;
esac esac
if test "$CXX" = "notfound" if test "$CXX" = "notfound"
@ -4220,10 +4515,11 @@ fi
fi fi
if test -z "$CXX" if test -z "$CXX"
then then
for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl if test -n "$ac_tool_prefix"; then
do for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
# Extract the first word of "$ac_prog", so it can be a program name with args. do
set dummy $ac_prog; ac_word=$2 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_CXX+:} false; then : if ${ac_cv_prog_CXX+:} false; then :
@ -4239,7 +4535,7 @@ do
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_CXX="$ac_prog" ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2 break 2
fi fi
@ -4259,9 +4555,65 @@ $as_echo "no" >&6; }
fi fi
test -n "$CXX" && break test -n "$CXX" && break
done
fi
if test -z "$CXX"; then
ac_ct_CXX=$CXX
for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_CXX+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done done
test -n "$CXX" || CXX="notfound" done
IFS=$as_save_IFS
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
$as_echo "$ac_ct_CXX" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_CXX" && break
done
if test "x$ac_ct_CXX" = x; then
CXX="notfound"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_ct_CXX
fi
fi
if test "$CXX" = "notfound" if test "$CXX" = "notfound"
then then
@ -4924,37 +5276,35 @@ $as_echo "$enable_shared" >&6; }
$as_echo_n "checking for --enable-profiling... " >&6; } $as_echo_n "checking for --enable-profiling... " >&6; }
# Check whether --enable-profiling was given. # Check whether --enable-profiling was given.
if test "${enable_profiling+set}" = set; then : if test "${enable_profiling+set}" = set; then :
enableval=$enable_profiling; ac_save_cc="$CC" enableval=$enable_profiling;
CC="$CC -pg" fi
if test "$cross_compiling" = yes; then :
ac_enable_profiling="no" if test "x$enable_profiling" = xyes; then
else ac_save_cc="$CC"
CC="$(CC) -pg"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
int main() { return 0; } int main() { return 0; }
_ACEOF _ACEOF
if ac_fn_c_try_run "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
ac_enable_profiling="yes"
else else
ac_enable_profiling="no" enable_profiling=no
fi fi
rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ rm -f core conftest.err conftest.$ac_objext \
conftest.$ac_objext conftest.beam conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
CC="$ac_save_cc"
else
enable_profiling=no
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_profiling" >&5
$as_echo "$enable_profiling" >&6; }
CC="$ac_save_cc" if test "x$enable_profiling" = xyes; then
BASECFLAGS="-pg $BASECFLAGS"
LDFLAGS="-pg $LDFLAGS"
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_enable_profiling" >&5
$as_echo "$ac_enable_profiling" >&6; }
case "$ac_enable_profiling" in
"yes")
BASECFLAGS="-pg $BASECFLAGS"
LDFLAGS="-pg $LDFLAGS"
;;
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking LDLIBRARY" >&5
$as_echo_n "checking LDLIBRARY... " >&6; } $as_echo_n "checking LDLIBRARY... " >&6; }
@ -5045,6 +5395,10 @@ else # shared is disabled
esac esac
fi fi
if test "$cross_compiling" = yes; then
RUNSHARED=
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDLIBRARY" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDLIBRARY" >&5
$as_echo "$LDLIBRARY" >&6; } $as_echo "$LDLIBRARY" >&6; }
@ -5141,10 +5495,11 @@ else
fi fi
for ac_prog in ar aal if test -n "$ac_tool_prefix"; then
do for ac_prog in ar aal
# Extract the first word of "$ac_prog", so it can be a program name with args. do
set dummy $ac_prog; ac_word=$2 # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; } $as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_AR+:} false; then : if ${ac_cv_prog_AR+:} false; then :
@ -5160,7 +5515,7 @@ do
test -z "$as_dir" && as_dir=. test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_AR="$ac_prog" ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2 break 2
fi fi
@ -5180,9 +5535,65 @@ $as_echo "no" >&6; }
fi fi
test -n "$AR" && break test -n "$AR" && break
done
fi
if test -z "$AR"; then
ac_ct_AR=$AR
for ac_prog in ar aal
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if ${ac_cv_prog_ac_ct_AR+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
ac_cv_prog_ac_ct_AR="$ac_prog"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done done
test -n "$AR" || AR="ar" done
IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
$as_echo "$ac_ct_AR" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
test -n "$ac_ct_AR" && break
done
if test "x$ac_ct_AR" = x; then
AR="ar"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
fi
fi
# 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
@ -5312,35 +5723,6 @@ bsdos*|hp*|HP*)
INSTALL="${srcdir}/install-sh -c" INSTALL="${srcdir}/install-sh -c"
fi fi
esac esac
ac_aux_dir=
for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
if test -f "$ac_dir/install-sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install-sh -c"
break
elif test -f "$ac_dir/install.sh"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/install.sh -c"
break
elif test -f "$ac_dir/shtool"; then
ac_aux_dir=$ac_dir
ac_install_sh="$ac_aux_dir/shtool install -c"
break
fi
done
if test -z "$ac_aux_dir"; then
as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
# and are intended to be withdrawn in a future Autoconf release.
# They can cause serious problems if a builder's source tree is in a directory
# whose full name contains unusual characters.
ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Find a good install program. We prefer a C program (faster), # Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or # so one script is as good as another. But avoid the broken or
# incompatible versions: # incompatible versions:
@ -5621,7 +6003,7 @@ $as_echo "$ac_cv_no_strict_aliasing_ok" >&6; }
# 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"
;; ;;
@ -10974,7 +11356,12 @@ $as_echo_n "checking getaddrinfo bug... " >&6; }
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if test "$cross_compiling" = yes; then : if test "$cross_compiling" = yes; then :
if test "${enable_ipv6+set}" = set; then
ac_cv_buggy_getaddrinfo="no -- configured with --(en|dis)able-ipv6"
else
ac_cv_buggy_getaddrinfo=yes ac_cv_buggy_getaddrinfo=yes
fi
else else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
@ -13840,34 +14227,73 @@ $as_echo "no" >&6; }
fi fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for device files" >&5
$as_echo "$as_me: checking for device files" >&6;}
if test "x$cross_compiling" = xyes; then
if test "${ac_cv_file__dev_ptmx+set}" != set; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
$as_echo_n "checking for /dev/ptmx... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5
$as_echo "not set" >&6; }
as_fn_error $? "set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
fi
if test "${ac_cv_file__dev_ptc+set}" != set; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
$as_echo_n "checking for /dev/ptc... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: not set" >&5
$as_echo "not set" >&6; }
as_fn_error $? "set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling" "$LINENO" 5
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptmx" >&5
$as_echo_n "checking for /dev/ptmx... " >&6; } $as_echo_n "checking for /dev/ptmx... " >&6; }
if ${ac_cv_file__dev_ptmx+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/ptmx"; then
ac_cv_file__dev_ptmx=yes
else
ac_cv_file__dev_ptmx=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_ptmx" >&5
$as_echo "$ac_cv_file__dev_ptmx" >&6; }
if test "x$ac_cv_file__dev_ptmx" = xyes; then :
if test -r /dev/ptmx fi
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 if test "x$ac_cv_file__dev_ptmx" = xyes; then
$as_echo "yes" >&6; }
$as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h $as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for /dev/ptc" >&5
$as_echo_n "checking for /dev/ptc... " >&6; } $as_echo_n "checking for /dev/ptc... " >&6; }
if ${ac_cv_file__dev_ptc+:} false; then :
$as_echo_n "(cached) " >&6
else
test "$cross_compiling" = yes &&
as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5
if test -r "/dev/ptc"; then
ac_cv_file__dev_ptc=yes
else
ac_cv_file__dev_ptc=no
fi
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_file__dev_ptc" >&5
$as_echo "$ac_cv_file__dev_ptc" >&6; }
if test "x$ac_cv_file__dev_ptc" = xyes; then :
if test -r /dev/ptc fi
then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 if test "x$ac_cv_file__dev_ptc" = xyes; then
$as_echo "yes" >&6; }
$as_echo "#define HAVE_DEV_PTC 1" >>confdefs.h $as_echo "#define HAVE_DEV_PTC 1" >>confdefs.h
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi fi
if test "$have_long_long" = yes if test "$have_long_long" = yes
@ -13878,7 +14304,36 @@ $as_echo_n "checking for %lld and %llu printf() format support... " >&6; }
$as_echo_n "(cached) " >&6 $as_echo_n "(cached) " >&6
else else
if test "$cross_compiling" = yes; then : if test "$cross_compiling" = yes; then :
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"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdio.h>
#include <stddef.h>
int
main ()
{
char *buffer;
sprintf(buffer, "%lld", (long long)123);
sprintf(buffer, "%lld", (long long)-123);
sprintf(buffer, "%llu", (unsigned long long)123);
;
return 0;
}
_ACEOF
if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_have_long_long_format=yes
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
CFLAGS=$save_CFLAGS
fi
else else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */

View file

@ -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)
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,20 +332,44 @@ then
else else
ac_sys_release=`uname -r` ac_sys_release=`uname -r`
fi fi
ac_md_system=`echo $ac_sys_system | fi
tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'` ac_md_system=`echo $ac_sys_system |
ac_md_release=`echo $ac_sys_release | tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'` ac_md_release=`echo $ac_sys_release |
MACHDEP="$ac_md_system$ac_md_release" tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
MACHDEP="$ac_md_system$ac_md_release"
case $MACHDEP in case $MACHDEP in
linux*) MACHDEP="linux2";; linux*) MACHDEP="linux2";;
cygwin*) MACHDEP="cygwin";; cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";; darwin*) MACHDEP="darwin";;
atheos*) MACHDEP="atheos";; atheos*) MACHDEP="atheos";;
irix646) MACHDEP="irix6";; irix646) MACHDEP="irix6";;
'') MACHDEP="unknown";; '') MACHDEP="unknown";;
esac
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 esac
_PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they # Some systems cannot stand _XOPEN_SOURCE being defined at all; they
@ -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"
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
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)
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
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)
# 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()
]]])], ]]])],
[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
[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
]]])], ]]])],
[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

View file

@ -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. */

214
setup.py
View file

@ -17,8 +17,20 @@ from distutils.command.install import install
from distutils.command.install_lib import install_lib from distutils.command.install_lib import install_lib
from distutils.spawn import find_executable from distutils.spawn import find_executable
cross_compiling = "_PYTHON_HOST_PLATFORM" in os.environ
def get_platform():
# cross build
if "_PYTHON_HOST_PLATFORM" in os.environ:
return os.environ["_PYTHON_HOST_PLATFORM"]
# Get value of sys.platform
if sys.platform.startswith('osf1'):
return 'osf1'
return sys.platform
host_platform = get_platform()
# Were we compiled --with-pydebug or with #define Py_DEBUG? # Were we compiled --with-pydebug or with #define Py_DEBUG?
COMPILED_WITH_PYDEBUG = hasattr(sys, 'gettotalrefcount') COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
# This global variable is used to hold the list of modules to be disabled. # This global variable is used to hold the list of modules to be disabled.
disabled_module_list = [] disabled_module_list = []
@ -62,7 +74,7 @@ def find_file(filename, std_dirs, paths):
'paths' is a list of additional locations to check; if the file is 'paths' is a list of additional locations to check; if the file is
found in one of them, the resulting list will contain the directory. found in one of them, the resulting list will contain the directory.
""" """
if sys.platform == 'darwin': if host_platform == 'darwin':
# Honor the MacOSX SDK setting when one was specified. # Honor the MacOSX SDK setting when one was specified.
# An SDK is a directory with the same structure as a real # An SDK is a directory with the same structure as a real
# system, but with only header files and libraries. # system, but with only header files and libraries.
@ -72,7 +84,7 @@ def find_file(filename, std_dirs, paths):
for dir in std_dirs: for dir in std_dirs:
f = os.path.join(dir, filename) f = os.path.join(dir, filename)
if sys.platform == 'darwin' and is_macosx_sdk_path(dir): if host_platform == 'darwin' and is_macosx_sdk_path(dir):
f = os.path.join(sysroot, dir[1:], filename) f = os.path.join(sysroot, dir[1:], filename)
if os.path.exists(f): return [] if os.path.exists(f): return []
@ -81,7 +93,7 @@ def find_file(filename, std_dirs, paths):
for dir in paths: for dir in paths:
f = os.path.join(dir, filename) f = os.path.join(dir, filename)
if sys.platform == 'darwin' and is_macosx_sdk_path(dir): if host_platform == 'darwin' and is_macosx_sdk_path(dir):
f = os.path.join(sysroot, dir[1:], filename) f = os.path.join(sysroot, dir[1:], filename)
if os.path.exists(f): if os.path.exists(f):
@ -95,7 +107,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
if result is None: if result is None:
return None return None
if sys.platform == 'darwin': if host_platform == 'darwin':
sysroot = macosx_sdk_root() sysroot = macosx_sdk_root()
# Check whether the found file is in one of the standard directories # Check whether the found file is in one of the standard directories
@ -104,7 +116,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
# Ensure path doesn't end with path separator # Ensure path doesn't end with path separator
p = p.rstrip(os.sep) p = p.rstrip(os.sep)
if sys.platform == 'darwin' and is_macosx_sdk_path(p): if host_platform == 'darwin' and is_macosx_sdk_path(p):
if os.path.join(sysroot, p[1:]) == dirname: if os.path.join(sysroot, p[1:]) == dirname:
return [ ] return [ ]
@ -117,7 +129,7 @@ def find_library_file(compiler, libname, std_dirs, paths):
# Ensure path doesn't end with path separator # Ensure path doesn't end with path separator
p = p.rstrip(os.sep) p = p.rstrip(os.sep)
if sys.platform == 'darwin' and is_macosx_sdk_path(p): if host_platform == 'darwin' and is_macosx_sdk_path(p):
if os.path.join(sysroot, p[1:]) == dirname: if os.path.join(sysroot, p[1:]) == dirname:
return [ p ] return [ p ]
@ -174,8 +186,8 @@ class PyBuildExt(build_ext):
# Platform-dependent module source and include directories # Platform-dependent module source and include directories
incdirlist = [] incdirlist = []
platform = self.get_platform()
if platform == 'darwin' and ("--disable-toolbox-glue" not in if host_platform == 'darwin' and ("--disable-toolbox-glue" not in
sysconfig.get_config_var("CONFIG_ARGS")): sysconfig.get_config_var("CONFIG_ARGS")):
# Mac OS X also includes some mac-specific modules # Mac OS X also includes some mac-specific modules
macmoddir = os.path.join(srcdir, 'Mac/Modules') macmoddir = os.path.join(srcdir, 'Mac/Modules')
@ -288,7 +300,7 @@ class PyBuildExt(build_ext):
ext.name) ext.name)
return return
if self.get_platform() == 'darwin' and ( if host_platform == 'darwin' and (
sys.maxint > 2**32 and '-arch' in ext.extra_link_args): sys.maxint > 2**32 and '-arch' in ext.extra_link_args):
# Don't bother doing an import check when an extension was # Don't bother doing an import check when an extension was
# build with an explicit '-arch' flag on OSX. That's currently # build with an explicit '-arch' flag on OSX. That's currently
@ -302,13 +314,18 @@ class PyBuildExt(build_ext):
# Workaround for Cygwin: Cygwin currently has fork issues when many # Workaround for Cygwin: Cygwin currently has fork issues when many
# modules have been imported # modules have been imported
if self.get_platform() == 'cygwin': if host_platform == 'cygwin':
self.announce('WARNING: skipping import check for Cygwin-based "%s"' self.announce('WARNING: skipping import check for Cygwin-based "%s"'
% ext.name) % ext.name)
return return
ext_filename = os.path.join( ext_filename = os.path.join(
self.build_lib, self.build_lib,
self.get_ext_filename(self.get_ext_fullname(ext.name))) self.get_ext_filename(self.get_ext_fullname(ext.name)))
# Don't try to load extensions for cross builds
if cross_compiling:
return
try: try:
imp.load_dynamic(ext.name, ext_filename) imp.load_dynamic(ext.name, ext_filename)
except ImportError, why: except ImportError, why:
@ -340,13 +357,6 @@ class PyBuildExt(build_ext):
level=3) level=3)
self.failed.append(ext.name) self.failed.append(ext.name)
def get_platform(self):
# Get value of sys.platform
for platform in ['cygwin', 'beos', 'darwin', 'atheos', 'osf1']:
if sys.platform.startswith(platform):
return platform
return sys.platform
def add_multiarch_paths(self): def add_multiarch_paths(self):
# Debian/Ubuntu multiarch support. # Debian/Ubuntu multiarch support.
# https://wiki.ubuntu.com/MultiarchSpec # https://wiki.ubuntu.com/MultiarchSpec
@ -373,12 +383,15 @@ class PyBuildExt(build_ext):
if not find_executable('dpkg-architecture'): if not find_executable('dpkg-architecture'):
return return
opt = ''
if cross_compiling:
opt = '-t' + sysconfig.get_config_var('HOST_GNU_TYPE')
tmpfile = os.path.join(self.build_temp, 'multiarch') tmpfile = os.path.join(self.build_temp, 'multiarch')
if not os.path.exists(self.build_temp): if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp) os.makedirs(self.build_temp)
ret = os.system( ret = os.system(
'dpkg-architecture -qDEB_HOST_MULTIARCH > %s 2> /dev/null' % 'dpkg-architecture %s -qDEB_HOST_MULTIARCH > %s 2> /dev/null' %
tmpfile) (opt, tmpfile))
try: try:
if ret >> 8 == 0: if ret >> 8 == 0:
with open(tmpfile) as fp: with open(tmpfile) as fp:
@ -390,6 +403,38 @@ class PyBuildExt(build_ext):
finally: finally:
os.unlink(tmpfile) os.unlink(tmpfile)
def add_gcc_paths(self):
gcc = sysconfig.get_config_var('CC')
tmpfile = os.path.join(self.build_temp, 'gccpaths')
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
ret = os.system('%s -E -v - </dev/null 2>%s 1>/dev/null' % (gcc, tmpfile))
is_gcc = False
in_incdirs = False
inc_dirs = []
lib_dirs = []
try:
if ret >> 8 == 0:
with open(tmpfile) as fp:
for line in fp.readlines():
if line.startswith("gcc version"):
is_gcc = True
elif line.startswith("#include <...>"):
in_incdirs = True
elif line.startswith("End of search list"):
in_incdirs = False
elif is_gcc and line.startswith("LIBRARY_PATH"):
for d in line.strip().split("=")[1].split(":"):
d = os.path.normpath(d)
if '/gcc/' not in d:
add_dir_to_list(self.compiler.library_dirs,
d)
elif is_gcc and in_incdirs and '/gcc/' not in line:
add_dir_to_list(self.compiler.include_dirs,
line.strip())
finally:
os.unlink(tmpfile)
def detect_modules(self): def detect_modules(self):
# Ensure that /usr/local is always used # Ensure that /usr/local is always used
add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib') add_dir_to_list(self.compiler.library_dirs, '/usr/local/lib')
@ -449,36 +494,42 @@ class PyBuildExt(build_ext):
# lib_dirs and inc_dirs are used to search for files; # lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can # if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed. # be assumed that no additional -I,-L directives are needed.
lib_dirs = self.compiler.library_dirs + [ inc_dirs = self.compiler.include_dirs[:]
'/lib64', '/usr/lib64', lib_dirs = self.compiler.library_dirs[:]
'/lib', '/usr/lib', if not cross_compiling:
] for d in (
inc_dirs = self.compiler.include_dirs + ['/usr/include'] '/usr/include',
):
add_dir_to_list(inc_dirs, d)
for d in (
'/lib64', '/usr/lib64',
'/lib', '/usr/lib',
):
add_dir_to_list(lib_dirs, d)
exts = [] exts = []
missing = [] missing = []
config_h = sysconfig.get_config_h_filename() config_h = sysconfig.get_config_h_filename()
config_h_vars = sysconfig.parse_config_h(open(config_h)) config_h_vars = sysconfig.parse_config_h(open(config_h))
platform = self.get_platform()
srcdir = sysconfig.get_config_var('srcdir') srcdir = sysconfig.get_config_var('srcdir')
# Check for AtheOS which has libraries in non-standard locations # Check for AtheOS which has libraries in non-standard locations
if platform == 'atheos': if host_platform == 'atheos':
lib_dirs += ['/system/libs', '/atheos/autolnk/lib'] lib_dirs += ['/system/libs', '/atheos/autolnk/lib']
lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep) lib_dirs += os.getenv('LIBRARY_PATH', '').split(os.pathsep)
inc_dirs += ['/system/include', '/atheos/autolnk/include'] inc_dirs += ['/system/include', '/atheos/autolnk/include']
inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep) inc_dirs += os.getenv('C_INCLUDE_PATH', '').split(os.pathsep)
# OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb) # OSF/1 and Unixware have some stuff in /usr/ccs/lib (like -ldb)
if platform in ['osf1', 'unixware7', 'openunix8']: if host_platform in ['osf1', 'unixware7', 'openunix8']:
lib_dirs += ['/usr/ccs/lib'] lib_dirs += ['/usr/ccs/lib']
# HP-UX11iv3 keeps files in lib/hpux folders. # HP-UX11iv3 keeps files in lib/hpux folders.
if platform == 'hp-ux11': if host_platform == 'hp-ux11':
lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32'] lib_dirs += ['/usr/lib/hpux64', '/usr/lib/hpux32']
if platform == 'darwin': if host_platform == 'darwin':
# This should work on any unixy platform ;-) # This should work on any unixy platform ;-)
# If the user has bothered specifying additional -I and -L flags # If the user has bothered specifying additional -I and -L flags
# in OPT and LDFLAGS we might as well use them here. # in OPT and LDFLAGS we might as well use them here.
@ -497,7 +548,7 @@ class PyBuildExt(build_ext):
# Check for MacOS X, which doesn't need libm.a at all # Check for MacOS X, which doesn't need libm.a at all
math_libs = ['m'] math_libs = ['m']
if platform in ['darwin', 'beos']: if host_platform in ['darwin', 'beos']:
math_libs = [] math_libs = []
# XXX Omitted modules: gl, pure, dl, SGI-specific modules # XXX Omitted modules: gl, pure, dl, SGI-specific modules
@ -569,7 +620,7 @@ class PyBuildExt(build_ext):
locale_libs = ['intl'] locale_libs = ['intl']
else: else:
locale_libs = [] locale_libs = []
if platform == 'darwin': if host_platform == 'darwin':
locale_extra_link_args = ['-framework', 'CoreFoundation'] locale_extra_link_args = ['-framework', 'CoreFoundation']
else: else:
locale_extra_link_args = [] locale_extra_link_args = []
@ -611,7 +662,7 @@ class PyBuildExt(build_ext):
exts.append( Extension('cPickle', ['cPickle.c']) ) exts.append( Extension('cPickle', ['cPickle.c']) )
# Memory-mapped files (also works on Win32). # Memory-mapped files (also works on Win32).
if platform not in ['atheos']: if host_platform not in ['atheos']:
exts.append( Extension('mmap', ['mmapmodule.c']) ) exts.append( Extension('mmap', ['mmapmodule.c']) )
else: else:
missing.append('mmap') missing.append('mmap')
@ -676,7 +727,7 @@ class PyBuildExt(build_ext):
elif self.compiler.find_library_file(lib_dirs, 'curses'): elif self.compiler.find_library_file(lib_dirs, 'curses'):
curses_library = 'curses' curses_library = 'curses'
if platform == 'darwin': if host_platform == 'darwin':
os_release = int(os.uname()[2].split('.')[0]) os_release = int(os.uname()[2].split('.')[0])
dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET') dep_target = sysconfig.get_config_var('MACOSX_DEPLOYMENT_TARGET')
if dep_target and dep_target.split('.') < ['10', '5']: if dep_target and dep_target.split('.') < ['10', '5']:
@ -688,7 +739,7 @@ class PyBuildExt(build_ext):
if find_file('readline/rlconf.h', inc_dirs, []) is None: if find_file('readline/rlconf.h', inc_dirs, []) is None:
do_readline = False do_readline = False
if do_readline: if do_readline:
if platform == 'darwin' and os_release < 9: if host_platform == 'darwin' and os_release < 9:
# In every directory on the search path search for a dynamic # In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking # library and then a static library, instead of first looking
# for dynamic libraries on the entiry path. # for dynamic libraries on the entiry path.
@ -766,7 +817,7 @@ class PyBuildExt(build_ext):
inc_dirs + search_for_ssl_incs_in) inc_dirs + search_for_ssl_incs_in)
if opensslv_h: if opensslv_h:
name = os.path.join(opensslv_h[0], 'openssl/opensslv.h') name = os.path.join(opensslv_h[0], 'openssl/opensslv.h')
if sys.platform == 'darwin' and is_macosx_sdk_path(name): if host_platform == 'darwin' and is_macosx_sdk_path(name):
name = os.path.join(macosx_sdk_root(), name[1:]) name = os.path.join(macosx_sdk_root(), name[1:])
try: try:
incfile = open(name, 'r') incfile = open(name, 'r')
@ -890,6 +941,9 @@ class PyBuildExt(build_ext):
db_inc_paths.append('/pkg/db-3.%d/include' % x) db_inc_paths.append('/pkg/db-3.%d/include' % x)
db_inc_paths.append('/opt/db-3.%d/include' % x) db_inc_paths.append('/opt/db-3.%d/include' % x)
if cross_compiling:
db_inc_paths = []
# Add some common subdirectories for Sleepycat DB to the list, # Add some common subdirectories for Sleepycat DB to the list,
# based on the standard include directories. This way DB3/4 gets # based on the standard include directories. This way DB3/4 gets
# picked up when it is installed in a non-standard prefix and # picked up when it is installed in a non-standard prefix and
@ -910,7 +964,7 @@ class PyBuildExt(build_ext):
db_ver_inc_map = {} db_ver_inc_map = {}
if sys.platform == 'darwin': if host_platform == 'darwin':
sysroot = macosx_sdk_root() sysroot = macosx_sdk_root()
class db_found(Exception): pass class db_found(Exception): pass
@ -920,7 +974,7 @@ class PyBuildExt(build_ext):
for d in inc_dirs + db_inc_paths: for d in inc_dirs + db_inc_paths:
f = os.path.join(d, "db.h") f = os.path.join(d, "db.h")
if sys.platform == 'darwin' and is_macosx_sdk_path(d): if host_platform == 'darwin' and is_macosx_sdk_path(d):
f = os.path.join(sysroot, d[1:], "db.h") f = os.path.join(sysroot, d[1:], "db.h")
if db_setup_debug: print "db: looking for db.h in", f if db_setup_debug: print "db: looking for db.h in", f
@ -970,7 +1024,7 @@ class PyBuildExt(build_ext):
db_incdir.replace("include", 'lib'), db_incdir.replace("include", 'lib'),
] ]
if sys.platform != 'darwin': if host_platform != 'darwin':
db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check) db_dirs_to_check = filter(os.path.isdir, db_dirs_to_check)
else: else:
@ -1038,6 +1092,8 @@ class PyBuildExt(build_ext):
'/usr/local/include/sqlite', '/usr/local/include/sqlite',
'/usr/local/include/sqlite3', '/usr/local/include/sqlite3',
] ]
if cross_compiling:
sqlite_inc_paths = []
MIN_SQLITE_VERSION_NUMBER = (3, 0, 8) MIN_SQLITE_VERSION_NUMBER = (3, 0, 8)
MIN_SQLITE_VERSION = ".".join([str(x) MIN_SQLITE_VERSION = ".".join([str(x)
for x in MIN_SQLITE_VERSION_NUMBER]) for x in MIN_SQLITE_VERSION_NUMBER])
@ -1045,12 +1101,12 @@ class PyBuildExt(build_ext):
# Scan the default include directories before the SQLite specific # Scan the default include directories before the SQLite specific
# ones. This allows one to override the copy of sqlite on OSX, # ones. This allows one to override the copy of sqlite on OSX,
# where /usr/include contains an old version of sqlite. # where /usr/include contains an old version of sqlite.
if sys.platform == 'darwin': if host_platform == 'darwin':
sysroot = macosx_sdk_root() sysroot = macosx_sdk_root()
for d_ in inc_dirs + sqlite_inc_paths: for d_ in inc_dirs + sqlite_inc_paths:
d = d_ d = d_
if sys.platform == 'darwin' and is_macosx_sdk_path(d): if host_platform == 'darwin' and is_macosx_sdk_path(d):
d = os.path.join(sysroot, d[1:]) d = os.path.join(sysroot, d[1:])
f = os.path.join(d, "sqlite3.h") f = os.path.join(d, "sqlite3.h")
@ -1100,7 +1156,7 @@ class PyBuildExt(build_ext):
'_sqlite/util.c', ] '_sqlite/util.c', ]
sqlite_defines = [] sqlite_defines = []
if sys.platform != "win32": if host_platform != "win32":
sqlite_defines.append(('MODULE_NAME', '"sqlite3"')) sqlite_defines.append(('MODULE_NAME', '"sqlite3"'))
else: else:
sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"')) sqlite_defines.append(('MODULE_NAME', '\\"sqlite3\\"'))
@ -1108,7 +1164,7 @@ class PyBuildExt(build_ext):
# Comment this out if you want the sqlite3 module to be able to load extensions. # Comment this out if you want the sqlite3 module to be able to load extensions.
sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1")) sqlite_defines.append(("SQLITE_OMIT_LOAD_EXTENSION", "1"))
if sys.platform == 'darwin': if host_platform == 'darwin':
# In every directory on the search path search for a dynamic # In every directory on the search path search for a dynamic
# library and then a static library, instead of first looking # library and then a static library, instead of first looking
# for dynamic libraries on the entire path. # for dynamic libraries on the entire path.
@ -1142,7 +1198,7 @@ class PyBuildExt(build_ext):
# when attempting to compile and it will fail. # when attempting to compile and it will fail.
f = "/usr/include/db.h" f = "/usr/include/db.h"
if sys.platform == 'darwin': if host_platform == 'darwin':
if is_macosx_sdk_path(f): if is_macosx_sdk_path(f):
sysroot = macosx_sdk_root() sysroot = macosx_sdk_root()
f = os.path.join(sysroot, f[1:]) f = os.path.join(sysroot, f[1:])
@ -1155,7 +1211,7 @@ class PyBuildExt(build_ext):
### XXX this should be fixed to not be platform-dependent ### XXX this should be fixed to not be platform-dependent
### but I don't have direct access to an osf1 platform and ### but I don't have direct access to an osf1 platform and
### seemed to be muffing the search somehow ### seemed to be muffing the search somehow
libraries = platform == "osf1" and ['db'] or None libraries = host_platform == "osf1" and ['db'] or None
if libraries is not None: if libraries is not None:
exts.append(Extension('bsddb185', ['bsddbmodule.c'], exts.append(Extension('bsddb185', ['bsddbmodule.c'],
libraries=libraries)) libraries=libraries))
@ -1168,7 +1224,7 @@ class PyBuildExt(build_ext):
dbm_order = ['gdbm'] dbm_order = ['gdbm']
# The standard Unix dbm module: # The standard Unix dbm module:
if platform not in ['cygwin']: if host_platform not in ['cygwin']:
config_args = [arg.strip("'") config_args = [arg.strip("'")
for arg in sysconfig.get_config_var("CONFIG_ARGS").split()] for arg in sysconfig.get_config_var("CONFIG_ARGS").split()]
dbm_args = [arg for arg in config_args dbm_args = [arg for arg in config_args
@ -1250,17 +1306,17 @@ class PyBuildExt(build_ext):
missing.append('gdbm') missing.append('gdbm')
# Unix-only modules # Unix-only modules
if platform not in ['win32']: if host_platform not in ['win32']:
# Steen Lumholt's termios module # Steen Lumholt's termios module
exts.append( Extension('termios', ['termios.c']) ) exts.append( Extension('termios', ['termios.c']) )
# Jeremy Hylton's rlimit interface # Jeremy Hylton's rlimit interface
if platform not in ['atheos']: if host_platform not in ['atheos']:
exts.append( Extension('resource', ['resource.c']) ) exts.append( Extension('resource', ['resource.c']) )
else: else:
missing.append('resource') missing.append('resource')
# Sun yellow pages. Some systems have the functions in libc. # Sun yellow pages. Some systems have the functions in libc.
if (platform not in ['cygwin', 'atheos', 'qnx6'] and if (host_platform not in ['cygwin', 'atheos', 'qnx6'] and
find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None): find_file('rpcsvc/yp_prot.h', inc_dirs, []) is not None):
if (self.compiler.find_library_file(lib_dirs, 'nsl')): if (self.compiler.find_library_file(lib_dirs, 'nsl')):
libs = ['nsl'] libs = ['nsl']
@ -1284,7 +1340,7 @@ class PyBuildExt(build_ext):
curses_libs = [curses_library] curses_libs = [curses_library]
exts.append( Extension('_curses', ['_cursesmodule.c'], exts.append( Extension('_curses', ['_cursesmodule.c'],
libraries = curses_libs) ) libraries = curses_libs) )
elif curses_library == 'curses' and platform != 'darwin': elif curses_library == 'curses' and host_platform != 'darwin':
# OSX has an old Berkeley curses, not good enough for # OSX has an old Berkeley curses, not good enough for
# the _curses module. # the _curses module.
if (self.compiler.find_library_file(lib_dirs, 'terminfo')): if (self.compiler.find_library_file(lib_dirs, 'terminfo')):
@ -1335,7 +1391,7 @@ class PyBuildExt(build_ext):
break break
if version >= version_req: if version >= version_req:
if (self.compiler.find_library_file(lib_dirs, 'z')): if (self.compiler.find_library_file(lib_dirs, 'z')):
if sys.platform == "darwin": if host_platform == "darwin":
zlib_extra_link_args = ('-Wl,-search_paths_first',) zlib_extra_link_args = ('-Wl,-search_paths_first',)
else: else:
zlib_extra_link_args = () zlib_extra_link_args = ()
@ -1367,7 +1423,7 @@ class PyBuildExt(build_ext):
# Gustavo Niemeyer's bz2 module. # Gustavo Niemeyer's bz2 module.
if (self.compiler.find_library_file(lib_dirs, 'bz2')): if (self.compiler.find_library_file(lib_dirs, 'bz2')):
if sys.platform == "darwin": if host_platform == "darwin":
bz2_extra_link_args = ('-Wl,-search_paths_first',) bz2_extra_link_args = ('-Wl,-search_paths_first',)
else: else:
bz2_extra_link_args = () bz2_extra_link_args = ()
@ -1440,7 +1496,7 @@ class PyBuildExt(build_ext):
if sys.maxint == 0x7fffffff: if sys.maxint == 0x7fffffff:
# This requires sizeof(int) == sizeof(long) == sizeof(char*) # This requires sizeof(int) == sizeof(long) == sizeof(char*)
dl_inc = find_file('dlfcn.h', [], inc_dirs) dl_inc = find_file('dlfcn.h', [], inc_dirs)
if (dl_inc is not None) and (platform not in ['atheos']): if (dl_inc is not None) and (host_platform not in ['atheos']):
exts.append( Extension('dl', ['dlmodule.c']) ) exts.append( Extension('dl', ['dlmodule.c']) )
else: else:
missing.append('dl') missing.append('dl')
@ -1451,29 +1507,29 @@ class PyBuildExt(build_ext):
self.detect_ctypes(inc_dirs, lib_dirs) self.detect_ctypes(inc_dirs, lib_dirs)
# Richard Oudkerk's multiprocessing module # Richard Oudkerk's multiprocessing module
if platform == 'win32': # Windows if host_platform == 'win32': # Windows
macros = dict() macros = dict()
libraries = ['ws2_32'] libraries = ['ws2_32']
elif platform == 'darwin': # Mac OSX elif host_platform == 'darwin': # Mac OSX
macros = dict() macros = dict()
libraries = [] libraries = []
elif platform == 'cygwin': # Cygwin elif host_platform == 'cygwin': # Cygwin
macros = dict() macros = dict()
libraries = [] libraries = []
elif platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'): elif host_platform in ('freebsd4', 'freebsd5', 'freebsd6', 'freebsd7', 'freebsd8'):
# FreeBSD's P1003.1b semaphore support is very experimental # FreeBSD's P1003.1b semaphore support is very experimental
# and has many known problems. (as of June 2008) # and has many known problems. (as of June 2008)
macros = dict() macros = dict()
libraries = [] libraries = []
elif platform.startswith('openbsd'): elif host_platform.startswith('openbsd'):
macros = dict() macros = dict()
libraries = [] libraries = []
elif platform.startswith('netbsd'): elif host_platform.startswith('netbsd'):
macros = dict() macros = dict()
libraries = [] libraries = []
@ -1481,7 +1537,7 @@ class PyBuildExt(build_ext):
macros = dict() macros = dict()
libraries = ['rt'] libraries = ['rt']
if platform == 'win32': if host_platform == 'win32':
multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c', multiprocessing_srcs = [ '_multiprocessing/multiprocessing.c',
'_multiprocessing/semaphore.c', '_multiprocessing/semaphore.c',
'_multiprocessing/pipe_connection.c', '_multiprocessing/pipe_connection.c',
@ -1508,26 +1564,26 @@ class PyBuildExt(build_ext):
# Platform-specific libraries # Platform-specific libraries
if platform == 'linux2': if host_platform == 'linux2':
# Linux-specific modules # Linux-specific modules
exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) ) exts.append( Extension('linuxaudiodev', ['linuxaudiodev.c']) )
else: else:
missing.append('linuxaudiodev') missing.append('linuxaudiodev')
if (platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6', if (host_platform in ('linux2', 'freebsd4', 'freebsd5', 'freebsd6',
'freebsd7', 'freebsd8') 'freebsd7', 'freebsd8')
or platform.startswith("gnukfreebsd")): or host_platform.startswith("gnukfreebsd")):
exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) ) exts.append( Extension('ossaudiodev', ['ossaudiodev.c']) )
else: else:
missing.append('ossaudiodev') missing.append('ossaudiodev')
if platform == 'sunos5': if host_platform == 'sunos5':
# SunOS specific modules # SunOS specific modules
exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) ) exts.append( Extension('sunaudiodev', ['sunaudiodev.c']) )
else: else:
missing.append('sunaudiodev') missing.append('sunaudiodev')
if platform == 'darwin': if host_platform == 'darwin':
# _scproxy # _scproxy
exts.append(Extension("_scproxy", [os.path.join(srcdir, "Mac/Modules/_scproxy.c")], exts.append(Extension("_scproxy", [os.path.join(srcdir, "Mac/Modules/_scproxy.c")],
extra_link_args= [ extra_link_args= [
@ -1536,7 +1592,7 @@ class PyBuildExt(build_ext):
])) ]))
if platform == 'darwin' and ("--disable-toolbox-glue" not in if host_platform == 'darwin' and ("--disable-toolbox-glue" not in
sysconfig.get_config_var("CONFIG_ARGS")): sysconfig.get_config_var("CONFIG_ARGS")):
if int(os.uname()[2].split('.')[0]) >= 8: if int(os.uname()[2].split('.')[0]) >= 8:
@ -1732,8 +1788,7 @@ class PyBuildExt(build_ext):
# Rather than complicate the code below, detecting and building # Rather than complicate the code below, detecting and building
# AquaTk is a separate method. Only one Tkinter will be built on # AquaTk is a separate method. Only one Tkinter will be built on
# Darwin - either AquaTk, if it is found, or X11 based Tk. # Darwin - either AquaTk, if it is found, or X11 based Tk.
platform = self.get_platform() if (host_platform == 'darwin' and
if (platform == 'darwin' and
self.detect_tkinter_darwin(inc_dirs, lib_dirs)): self.detect_tkinter_darwin(inc_dirs, lib_dirs)):
return return
@ -1756,7 +1811,7 @@ class PyBuildExt(build_ext):
# Check for the include files on Debian and {Free,Open}BSD, where # Check for the include files on Debian and {Free,Open}BSD, where
# they're put in /usr/include/{tcl,tk}X.Y # they're put in /usr/include/{tcl,tk}X.Y
dotversion = version dotversion = version
if '.' not in dotversion and "bsd" in sys.platform.lower(): if '.' not in dotversion and "bsd" in host_platform.lower():
# OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a, # OpenBSD and FreeBSD use Tcl/Tk library names like libtcl83.a,
# but the include subdirs are named like .../include/tcl8.3. # but the include subdirs are named like .../include/tcl8.3.
dotversion = dotversion[:-1] + '.' + dotversion[-1] dotversion = dotversion[:-1] + '.' + dotversion[-1]
@ -1782,7 +1837,7 @@ class PyBuildExt(build_ext):
include_dirs.append(dir) include_dirs.append(dir)
# Check for various platform-specific directories # Check for various platform-specific directories
if platform == 'sunos5': if host_platform == 'sunos5':
include_dirs.append('/usr/openwin/include') include_dirs.append('/usr/openwin/include')
added_lib_dirs.append('/usr/openwin/lib') added_lib_dirs.append('/usr/openwin/lib')
elif os.path.exists('/usr/X11R6/include'): elif os.path.exists('/usr/X11R6/include'):
@ -1798,7 +1853,7 @@ class PyBuildExt(build_ext):
added_lib_dirs.append('/usr/X11/lib') added_lib_dirs.append('/usr/X11/lib')
# If Cygwin, then verify that X is installed before proceeding # If Cygwin, then verify that X is installed before proceeding
if platform == 'cygwin': if host_platform == 'cygwin':
x11_inc = find_file('X11/Xlib.h', [], include_dirs) x11_inc = find_file('X11/Xlib.h', [], include_dirs)
if x11_inc is None: if x11_inc is None:
return return
@ -1817,11 +1872,11 @@ class PyBuildExt(build_ext):
libs.append('tk'+ version) libs.append('tk'+ version)
libs.append('tcl'+ version) libs.append('tcl'+ version)
if platform in ['aix3', 'aix4']: if host_platform in ['aix3', 'aix4']:
libs.append('ld') libs.append('ld')
# Finally, link with the X11 libraries (not appropriate on cygwin) # Finally, link with the X11 libraries (not appropriate on cygwin)
if platform != "cygwin": if host_platform != "cygwin":
libs.append('X11') libs.append('X11')
ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'], ext = Extension('_tkinter', ['_tkinter.c', 'tkappinit.c'],
@ -1873,7 +1928,7 @@ class PyBuildExt(build_ext):
def configure_ctypes(self, ext): def configure_ctypes(self, ext):
if not self.use_system_libffi: if not self.use_system_libffi:
if sys.platform == 'darwin': if host_platform == 'darwin':
return self.configure_ctypes_darwin(ext) return self.configure_ctypes_darwin(ext)
srcdir = sysconfig.get_config_var('srcdir') srcdir = sysconfig.get_config_var('srcdir')
@ -1891,7 +1946,8 @@ class PyBuildExt(build_ext):
ffi_configfile): ffi_configfile):
from distutils.dir_util import mkpath from distutils.dir_util import mkpath
mkpath(ffi_builddir) mkpath(ffi_builddir)
config_args = [] config_args = [arg for arg in sysconfig.get_config_var("CONFIG_ARGS").split()
if (('--host=' in arg) or ('--build=' in arg))]
if not self.verbose: if not self.verbose:
config_args.append("-q") config_args.append("-q")
@ -1935,7 +1991,7 @@ class PyBuildExt(build_ext):
'_ctypes/cfield.c'] '_ctypes/cfield.c']
depends = ['_ctypes/ctypes.h'] depends = ['_ctypes/ctypes.h']
if sys.platform == 'darwin': if host_platform == 'darwin':
sources.append('_ctypes/malloc_closure.c') sources.append('_ctypes/malloc_closure.c')
sources.append('_ctypes/darwin/dlfcn_simple.c') sources.append('_ctypes/darwin/dlfcn_simple.c')
extra_compile_args.append('-DMACOSX') extra_compile_args.append('-DMACOSX')
@ -1943,7 +1999,7 @@ class PyBuildExt(build_ext):
# XXX Is this still needed? # XXX Is this still needed?
## extra_link_args.extend(['-read_only_relocs', 'warning']) ## extra_link_args.extend(['-read_only_relocs', 'warning'])
elif sys.platform == 'sunos5': elif host_platform == 'sunos5':
# XXX This shouldn't be necessary; it appears that some # XXX This shouldn't be necessary; it appears that some
# of the assembler code is non-PIC (i.e. it has relocations # of the assembler code is non-PIC (i.e. it has relocations
# when it shouldn't. The proper fix would be to rewrite # when it shouldn't. The proper fix would be to rewrite
@ -1954,7 +2010,7 @@ class PyBuildExt(build_ext):
# finding some -z option for the Sun compiler. # finding some -z option for the Sun compiler.
extra_link_args.append('-mimpure-text') extra_link_args.append('-mimpure-text')
elif sys.platform.startswith('hp-ux'): elif host_platform.startswith('hp-ux'):
extra_link_args.append('-fPIC') extra_link_args.append('-fPIC')
ext = Extension('_ctypes', ext = Extension('_ctypes',
@ -1971,7 +2027,7 @@ class PyBuildExt(build_ext):
if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"): if not '--with-system-ffi' in sysconfig.get_config_var("CONFIG_ARGS"):
return return
if sys.platform == 'darwin': if host_platform == 'darwin':
# OS X 10.5 comes with libffi.dylib; the include files are # OS X 10.5 comes with libffi.dylib; the include files are
# in /usr/include/ffi # in /usr/include/ffi
inc_dirs.append('/usr/include/ffi') inc_dirs.append('/usr/include/ffi')