Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(92032)

Unified Diff: configure.ac

Issue 17086: backport cross-build patches to the 2.7 branch
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « configure ('k') | Lib/distutils/sysconfig.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/configure.ac Tue Jan 29 22:59:02 2013 +0000
+++ b/configure.ac Thu Jan 31 00:03:23 2013 +0100
@@ -12,6 +12,33 @@
AC_CONFIG_SRCDIR([Include/object.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 it does, we get path names containing '//' which is both ugly and
dnl can cause trouble.
@@ -279,6 +306,25 @@
AC_MSG_CHECKING(MACHDEP)
if test -z "$MACHDEP"
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`
if test "$ac_sys_system" = "AIX" \
-o "$ac_sys_system" = "UnixWare" -o "$ac_sys_system" = "OpenUNIX"; then
@@ -286,20 +332,44 @@
else
ac_sys_release=`uname -r`
fi
- ac_md_system=`echo $ac_sys_system |
- tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
- ac_md_release=`echo $ac_sys_release |
- tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
- MACHDEP="$ac_md_system$ac_md_release"
-
- case $MACHDEP in
+ fi
+ ac_md_system=`echo $ac_sys_system |
+ tr -d '[/ ]' | tr '[[A-Z]]' '[[a-z]]'`
+ ac_md_release=`echo $ac_sys_release |
+ tr -d '[/ ]' | sed 's/^[[A-Z]]\.//' | sed 's/\..*//'`
+ MACHDEP="$ac_md_system$ac_md_release"
+
+ case $MACHDEP in
linux*) MACHDEP="linux2";;
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
atheos*) MACHDEP="atheos";;
irix646) MACHDEP="irix6";;
'') 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
+ _PYTHON_HOST_PLATFORM="$MACHDEP${_host_cpu:+-$_host_cpu}"
fi
# Some systems cannot stand _XOPEN_SOURCE being defined at all; they
@@ -446,10 +516,6 @@
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
-AC_MSG_CHECKING(machine type as reported by uname -m)
-ac_sys_machine=`uname -m`
-AC_MSG_RESULT($ac_sys_machine)
-
# checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@@ -578,8 +644,8 @@
if test -z "$CXX"
then
case "$CC" in
- gcc) AC_PATH_PROG(CXX, [g++], [g++], [notfound]) ;;
- cc) AC_PATH_PROG(CXX, [c++], [c++], [notfound]) ;;
+ gcc) AC_PATH_TOOL(CXX, [g++], [g++], [notfound]) ;;
+ cc) AC_PATH_TOOL(CXX, [c++], [c++], [notfound]) ;;
esac
if test "$CXX" = "notfound"
then
@@ -588,7 +654,7 @@
fi
if test -z "$CXX"
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"
then
CXX=""
@@ -764,22 +830,23 @@
AC_MSG_CHECKING(for --enable-profiling)
AC_ARG_ENABLE(profiling,
- AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]),
-[ac_save_cc="$CC"
- CC="$CC -pg"
- AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
- [ac_enable_profiling="yes"],
- [ac_enable_profiling="no"],
- [ac_enable_profiling="no"])
- CC="$ac_save_cc"])
-AC_MSG_RESULT($ac_enable_profiling)
-
-case "$ac_enable_profiling" in
- "yes")
- BASECFLAGS="-pg $BASECFLAGS"
- LDFLAGS="-pg $LDFLAGS"
- ;;
-esac
+ AS_HELP_STRING([--enable-profiling], [enable C-level code profiling]))
+if test "x$enable_profiling" = xyes; then
+ ac_save_cc="$CC"
+ CC="$(CC) -pg"
+ AC_LINK_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],
+ [],
+ [enable_profiling=no])
+ CC="$ac_save_cc"
+else
+ enable_profiling=no
+fi
+AC_MSG_RESULT($enable_profiling)
+
+if test "x$enable_profiling" = xyes; then
+ BASECFLAGS="-pg $BASECFLAGS"
+ LDFLAGS="-pg $LDFLAGS"
+fi
AC_MSG_CHECKING(LDLIBRARY)
@@ -868,11 +935,15 @@
esac
fi
+if test "$cross_compiling" = yes; then
+ RUNSHARED=
+fi
+
AC_MSG_RESULT($LDLIBRARY)
AC_PROG_RANLIB
AC_SUBST(AR)
-AC_CHECK_PROGS(AR, ar aal, ar)
+AC_CHECK_TOOLS(AR, ar aal, ar)
# tweak ARFLAGS only if the user didn't set it on the command line
AC_SUBST(ARFLAGS)
@@ -1046,7 +1117,7 @@
# if using gcc on alpha, use -mieee to get (near) full IEEE 754
# support. Without this, treatment of subnormals doesn't follow
# the standard.
- case $ac_sys_machine in
+ case $host in
alpha*)
BASECFLAGS="$BASECFLAGS -mieee"
;;
@@ -3216,7 +3287,12 @@
]]])],
[ac_cv_buggy_getaddrinfo=no],
[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
AC_MSG_RESULT($ac_cv_buggy_getaddrinfo)
@@ -4246,26 +4322,31 @@
[AC_MSG_RESULT(no)]
)
-AC_MSG_CHECKING(for /dev/ptmx)
-
-if test -r /dev/ptmx
-then
- AC_MSG_RESULT(yes)
+AC_MSG_NOTICE([checking for device files])
+
+dnl NOTE: Inform user how to proceed with files when cross compiling.
+if test "x$cross_compiling" = xyes; then
+ if test "${ac_cv_file__dev_ptmx+set}" != set; then
+ AC_MSG_CHECKING([for /dev/ptmx])
+ AC_MSG_RESULT([not set])
+ AC_MSG_ERROR([set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling])
+ fi
+ if test "${ac_cv_file__dev_ptc+set}" != set; then
+ AC_MSG_CHECKING([for /dev/ptc])
+ AC_MSG_RESULT([not set])
+ AC_MSG_ERROR([set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling])
+ fi
+fi
+
+AC_CHECK_FILE(/dev/ptmx, [], [])
+if test "x$ac_cv_file__dev_ptmx" = xyes; then
AC_DEFINE(HAVE_DEV_PTMX, 1,
- [Define if we have /dev/ptmx.])
-else
- AC_MSG_RESULT(no)
+ [Define to 1 if you have the /dev/ptmx device file.])
fi
-
-AC_MSG_CHECKING(for /dev/ptc)
-
-if test -r /dev/ptc
-then
- AC_MSG_RESULT(yes)
+AC_CHECK_FILE(/dev/ptc, [], [])
+if test "x$ac_cv_file__dev_ptc" = xyes; then
AC_DEFINE(HAVE_DEV_PTC, 1,
- [Define if we have /dev/ptc.])
-else
- AC_MSG_RESULT(no)
+ [Define to 1 if you have the /dev/ptc device file.])
fi
if test "$have_long_long" = yes
@@ -4305,7 +4386,23 @@
]]])],
[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="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)
fi
« no previous file with comments | « configure ('k') | Lib/distutils/sysconfig.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+