diff options
author | Ned Deily <nad@acm.org> | 2013-10-19 04:09:56 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2013-10-19 04:09:56 (GMT) |
commit | 87adb6ef38393932cbab3a1ec3769bafc7d740e2 (patch) | |
tree | ab2e933a355c7eed268eb213de8d9886070cd6ae /configure.ac | |
parent | ea41d5f27c8d4b8c546a078d190b131d6c9c2fd7 (diff) | |
download | cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.zip cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.tar.gz cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.tar.bz2 |
Issue #14499: Fix several problems with OS X universal build support:
1. ppc arch detection for extension module builds broke with Xcode 5
2. ppc arch detection in configure did not work on OS X 10.4
3. -sysroot and -arch flags were unnecessarily duplicated
4. there was no obvious way to configure an intel-32 only build.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 239 |
1 files changed, 122 insertions, 117 deletions
diff --git a/configure.ac b/configure.ac index c63e34b..e1d3e77 100644 --- a/configure.ac +++ b/configure.ac @@ -152,7 +152,7 @@ AC_ARG_ENABLE(universalsdk, # Locate the best usable SDK, see Mac/README.txt for more # information enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`" - if test -z "${enableval}" + if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null ) then enableval=/Developer/SDKs/MacOSX10.4u.sdk if test ! -d "${enableval}" @@ -189,6 +189,7 @@ fi AC_SUBST(UNIVERSALSDK) AC_SUBST(ARCH_RUN_32BIT) +ARCH_RUN_32BIT="" # For backward compatibility reasons we prefer to select '32-bit' if available, # otherwise use 'intel' @@ -197,7 +198,7 @@ if test "`uname -s`" = "Darwin" then if test -n "${UNIVERSALSDK}" then - if test -z "`/usr/bin/file "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`" + if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`" then UNIVERSAL_ARCHS="intel" fi @@ -207,16 +208,17 @@ fi AC_SUBST(LIPO_32BIT_FLAGS) AC_MSG_CHECKING(for --with-universal-archs) AC_ARG_WITH(universal-archs, - AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel" or "all")]), + AS_HELP_STRING([--with-universal-archs=ARCH], [select architectures for universal build ("32-bit", "64-bit", "3-way", "intel", "intel-32", or "all")]), [ - AC_MSG_RESULT($withval) UNIVERSAL_ARCHS="$withval" ], -[ - AC_MSG_RESULT(${UNIVERSAL_ARCHS}) -]) - - +[]) +if test -n "${UNIVERSALSDK}" +then + AC_MSG_RESULT(${UNIVERSAL_ARCHS}) +else + AC_MSG_RESULT(no) +fi AC_ARG_WITH(framework-name, AS_HELP_STRING([--with-framework-name=FRAMEWORK], @@ -1219,111 +1221,120 @@ yes) SCO_SV*) BASECFLAGS="$BASECFLAGS -m486 -DSCO5" ;; - # is there any other compiler on Darwin besides gcc? - Darwin*) - # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd - # used to be here, but non-Apple gcc doesn't accept them. - if test "${CC}" = gcc - then - AC_MSG_CHECKING(which compiler should be used) - case "${UNIVERSALSDK}" in - */MacOSX10.4u.sdk) - # Build using 10.4 SDK, force usage of gcc when the - # compiler is gcc, otherwise the user will get very - # confusing error messages when building on OSX 10.6 - CC=gcc-4.0 - CPP=cpp-4.0 - ;; - esac - AC_MSG_RESULT($CC) - fi - - - if test "${enable_universalsdk}"; then - UNIVERSAL_ARCH_FLAGS="" - if test "$UNIVERSAL_ARCHS" = "32-bit" ; then - UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" - ARCH_RUN_32BIT="" - LIPO_32BIT_FLAGS="" - elif test "$UNIVERSAL_ARCHS" = "64-bit" ; then - UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" - LIPO_32BIT_FLAGS="" - ARCH_RUN_32BIT="true" - - elif test "$UNIVERSAL_ARCHS" = "all" ; then - UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" - LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" - ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" - - elif test "$UNIVERSAL_ARCHS" = "intel" ; then - UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64" - LIPO_32BIT_FLAGS="-extract i386" - ARCH_RUN_32BIT="/usr/bin/arch -i386" - - elif test "$UNIVERSAL_ARCHS" = "3-way" ; then - UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64" - LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" - ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" - - else - AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way]) - - fi + # is there any other compiler on Darwin besides gcc? + Darwin*) + # -Wno-long-double, -no-cpp-precomp, and -mno-fused-madd + # used to be here, but non-Apple gcc doesn't accept them. + if test "${CC}" = gcc + then + AC_MSG_CHECKING(which compiler should be used) + case "${UNIVERSALSDK}" in + */MacOSX10.4u.sdk) + # Build using 10.4 SDK, force usage of gcc when the + # compiler is gcc, otherwise the user will get very + # confusing error messages when building on OSX 10.6 + CC=gcc-4.0 + CPP=cpp-4.0 + ;; + esac + AC_MSG_RESULT($CC) + fi - CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" - if test "${UNIVERSALSDK}" != "/" - then - CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}" - LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}" - CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" - fi - fi - - # Calculate the right deployment target for this build. - # - cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` - if test ${cur_target} '>' 10.2 && \ - test ${cur_target} '<' 10.6 - then - cur_target=10.3 - if test ${enable_universalsdk}; then - if test "${UNIVERSAL_ARCHS}" = "all"; then - # Ensure that the default platform for a - # 4-way universal build is OSX 10.5, - # that's the first OS release where - # 4-way builds make sense. - cur_target='10.5' - - elif test "${UNIVERSAL_ARCHS}" = "3-way"; then - cur_target='10.5' - - elif test "${UNIVERSAL_ARCHS}" = "intel"; then - cur_target='10.5' - - elif test "${UNIVERSAL_ARCHS}" = "64-bit"; then - cur_target='10.5' - fi - else - if test `/usr/bin/arch` = "i386"; then - # On Intel macs default to a deployment - # target of 10.4, that's the first OSX - # release with Intel support. - cur_target="10.4" - fi - fi - fi - CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} - - # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the - # environment with a value that is the same as what we'll use - # in the Makefile to ensure that we'll get the same compiler - # environment during configure and build time. - MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" - export MACOSX_DEPLOYMENT_TARGET - EXPORT_MACOSX_DEPLOYMENT_TARGET='' + if test "${enable_universalsdk}" + then + case "$UNIVERSAL_ARCHS" in + 32-bit) + UNIVERSAL_ARCH_FLAGS="-arch ppc -arch i386" + LIPO_32BIT_FLAGS="" + ARCH_RUN_32BIT="" + ;; + 64-bit) + UNIVERSAL_ARCH_FLAGS="-arch ppc64 -arch x86_64" + LIPO_32BIT_FLAGS="" + ARCH_RUN_32BIT="true" + ;; + all) + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch ppc64 -arch x86_64" + LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" + ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" + ;; + intel) + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch x86_64" + LIPO_32BIT_FLAGS="-extract i386" + ARCH_RUN_32BIT="/usr/bin/arch -i386" + ;; + intel-32) + UNIVERSAL_ARCH_FLAGS="-arch i386" + LIPO_32BIT_FLAGS="" + ARCH_RUN_32BIT="" + ;; + 3-way) + UNIVERSAL_ARCH_FLAGS="-arch i386 -arch ppc -arch x86_64" + LIPO_32BIT_FLAGS="-extract ppc7400 -extract i386" + ARCH_RUN_32BIT="/usr/bin/arch -i386 -ppc" + ;; + *) + AC_MSG_ERROR([proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way]) + ;; + esac + + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + if test "${UNIVERSALSDK}" != "/" + then + CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" + fi + fi - ;; + # Calculate an appropriate deployment target for this build: + # The deployment target value is used explicitly to enable certain + # features are enabled (such as builtin libedit support for readline) + # through the use of Apple's Availabiliy Macros and is used as a + # component of the string returned by distutils.get_platform(). + # + # Use the value from: + # 1. the MACOSX_DEPLOYMENT_TARGET environment variable if specified + # 2. the operating system version of the build machine if >= 10.6 + # 3. If running on OS X 10.3 through 10.5, use the legacy tests + # below to pick either 10.3, 10.4, or 10.5 as the target. + # 4. If we are running on OS X 10.2 or earlier, good luck! + + AC_MSG_CHECKING(which MACOSX_DEPLOYMENT_TARGET to use) + cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'` + if test ${cur_target} '>' 10.2 && \ + test ${cur_target} '<' 10.6 + then + cur_target=10.3 + if test ${enable_universalsdk} + then + case "$UNIVERSAL_ARCHS" in + all|3-way|intel|64-bit) + # These configurations were first supported in 10.5 + cur_target='10.5' + ;; + esac + else + if test `/usr/bin/arch` = "i386" + then + # 10.4 was the first release to support Intel archs + cur_target="10.4" + fi + fi + fi + CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}} + + # Make sure that MACOSX_DEPLOYMENT_TARGET is set in the + # environment with a value that is the same as what we'll use + # in the Makefile to ensure that we'll get the same compiler + # environment during configure and build time. + MACOSX_DEPLOYMENT_TARGET="$CONFIGURE_MACOSX_DEPLOYMENT_TARGET" + export MACOSX_DEPLOYMENT_TARGET + EXPORT_MACOSX_DEPLOYMENT_TARGET='' + AC_MSG_RESULT($MACOSX_DEPLOYMENT_TARGET) + + # end of Darwin* tests + ;; esac ;; @@ -1804,7 +1815,6 @@ case $ac_sys_system/$ac_sys_release in esac -ARCH_RUN_32BIT="" AC_SUBST(LIBTOOL_CRUFT) case $ac_sys_system/$ac_sys_release in Darwin/@<:@01567@:>@\..*) @@ -1861,14 +1871,12 @@ case $ac_sys_system/$ac_sys_release in ;; esac - #ARCH_RUN_32BIT="true" fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)' LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';; esac - AC_MSG_CHECKING(for --enable-framework) if test "$enable_framework" then @@ -1988,9 +1996,6 @@ then if test ${MACOSX_DEPLOYMENT_TARGET} '>' 10.2 then - if test "${enable_universalsdk}"; then - LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" - fi LDSHARED='$(CC) -bundle -undefined dynamic_lookup' LDCXXSHARED='$(CXX) -bundle -undefined dynamic_lookup' BLDSHARED="$LDSHARED" |