diff options
author | Ned Deily <nad@python.org> | 2018-04-14 14:37:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-14 14:37:28 (GMT) |
commit | ee8e4b61d6181f5bfadf6ee3d229f0ebda8a6ae9 (patch) | |
tree | 525154fe97b72b68d70f9f320bf3aeee3dbd2393 /configure | |
parent | a61f5da54772b0ea6a7eccf21df08e61585ef712 (diff) | |
download | cpython-ee8e4b61d6181f5bfadf6ee3d229f0ebda8a6ae9.zip cpython-ee8e4b61d6181f5bfadf6ee3d229f0ebda8a6ae9.tar.gz cpython-ee8e4b61d6181f5bfadf6ee3d229f0ebda8a6ae9.tar.bz2 |
[2.7] Backport macOS universal build and installer fixes from 3.6. (GH-6469)
These include:
- bpo-32726: Provide an additional, more modern macOS installer variant that
supports macOS 10.9+ systems in 64-bit mode only. Upgrade the supplied
third-party libraries to OpenSSL 1.0.2n and SQLite 3.22.0. The 10.9+
installer now supplies its own private copy of Tcl/Tk 8.6.8.
- bpo-24414: Default macOS deployment target is now set by ``configure`` to
the build system's OS version (as is done by Python 3), not ``10.4``;
override with, for example, ``./configure MACOSX_DEPLOYMENT_TARGET=10.4``.
- bpo-19019: All 2.7 macOS installer variants now supply their own version
of ``OpenSSL 1.0.2``; the Apple-supplied SSL libraries and root
certificates are not longer used. The ``Installer Certificate`` command
in ``/Applications/Python 2.7`` may be used to download and install a
default set of root certificates from the third-party ``certifi`` package.
- bpo-11485: python.org macOS Pythons no longer supply a default SDK value
(e.g. ``-isysroot /``) or specific compiler version default (e.g.
``gcc-4.2``) when building extension modules. Use ``CC``, ``SDKROOT``,
and ``DEVELOPER_DIR`` environment variables to override compilers or to
use an SDK. See Apple's ``xcrun`` man page for more info.
- prepare for pending Apple removal of 32-bit support in future macOS release
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 293 |
1 files changed, 160 insertions, 133 deletions
@@ -1457,7 +1457,7 @@ Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-universalsdk[=SDKDIR] - Build against Mac OS X 10.4u SDK (ppc/i386) + Build fat binary against Mac OS X SDK --enable-framework[=INSTALLDIR] Build (MacOSX|Darwin) framework --enable-shared disable/enable building shared python library @@ -1477,7 +1477,8 @@ Optional Packages: --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-universal-archs=ARCH select architectures for universal build ("32-bit", - "64-bit", "3-way", "intel" or "all") + "64-bit", "3-way", "intel", "intel-32", "intel-64", + or "all") --with-framework-name=FRAMEWORK specify an alternate name of the framework built with --enable-framework @@ -3039,10 +3040,16 @@ if test "${enable_universalsdk+set}" = set; then : enableval=$enable_universalsdk; case $enableval in yes) - enableval=/Developer/SDKs/MacOSX10.4u.sdk - if test ! -d "${enableval}" + # Locate the best usable SDK, see Mac/README.txt for more + # information + enableval="`/usr/bin/xcodebuild -version -sdk macosx Path 2>/dev/null`" + if ! ( echo $enableval | grep -E '\.sdk' 1>/dev/null ) then - enableval=/ + enableval=/Developer/SDKs/MacOSX10.4u.sdk + if test ! -d "${enableval}" + then + enableval=/ + fi fi ;; esac @@ -3081,7 +3088,20 @@ fi ARCH_RUN_32BIT="" +# For backward compatibility reasons we prefer to select '32-bit' if available, +# otherwise use 'intel' UNIVERSAL_ARCHS="32-bit" +if test "`uname -s`" = "Darwin" +then + if test -n "${UNIVERSALSDK}" + then + if test -z "`/usr/bin/file -L "${UNIVERSALSDK}/usr/lib/libSystem.dylib" | grep ppc`" + then + UNIVERSAL_ARCHS="intel" + fi + fi +fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --with-universal-archs" >&5 $as_echo_n "checking for --with-universal-archs... " >&6; } @@ -3089,24 +3109,18 @@ $as_echo_n "checking for --with-universal-archs... " >&6; } # Check whether --with-universal-archs was given. if test "${with_universal_archs+set}" = set; then : withval=$with_universal_archs; - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $withval" >&5 -$as_echo "$withval" >&6; } UNIVERSAL_ARCHS="$withval" - if test "${enable_universalsdk}" ; then - : - else - as_fn_error $? "--with-universal-archs without --enable-universalsdk. See Mac/README" "$LINENO" 5 - fi - -else - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: 32-bit" >&5 -$as_echo "32-bit" >&6; } fi - - +if test -n "${UNIVERSALSDK}" +then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${UNIVERSAL_ARCHS}" >&5 +$as_echo "${UNIVERSAL_ARCHS}" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi # Check whether --with-framework-name was given. @@ -6084,119 +6098,137 @@ $as_echo "$ac_cv_no_strict_aliasing_ok" >&6; } 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5 + # 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which compiler should be used" >&5 $as_echo_n "checking which compiler should be used... " >&6; } - 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 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } - fi - - # Calculate the right deployment target for this build. - # - cur_target_major=`sw_vers -productVersion | \ - sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` - cur_target_minor=`sw_vers -productVersion | \ - sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` - cur_target="${cur_target_major}.${cur_target_minor}" - if test ${cur_target_major} -eq 10 && \ - test ${cur_target_minor} -ge 3 - 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 - 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 - as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5 - - fi - - - CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}" - if test "${UNIVERSALSDK}" != "/" - then - CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" - LDFLAGS="-isysroot ${UNIVERSALSDK} ${LDFLAGS}" - CFLAGS="-isysroot ${UNIVERSALSDK} ${CFLAGS}" - fi - - fi + fi + 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="" + ;; + 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="" + ;; + intel-64) + UNIVERSAL_ARCH_FLAGS="-arch x86_64" + 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" + ;; + *) + as_fn_error $? "proper usage is --with-universal-arch=32-bit|64-bit|all|intel|3-way" "$LINENO" 5 + ;; + esac + + if test "${UNIVERSALSDK}" != "/" + then + CFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${CFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} -isysroot ${UNIVERSALSDK} ${LDFLAGS}" + CPPFLAGS="-isysroot ${UNIVERSALSDK} ${CPPFLAGS}" + else + CFLAGS="${UNIVERSAL_ARCH_FLAGS} ${CFLAGS}" + LDFLAGS="${UNIVERSAL_ARCH_FLAGS} ${LDFLAGS}" + 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 Availability 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! + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking which MACOSX_DEPLOYMENT_TARGET to use" >&5 +$as_echo_n "checking which MACOSX_DEPLOYMENT_TARGET to use... " >&6; } + cur_target_major=`sw_vers -productVersion | \ + sed 's/\([0-9]*\)\.\([0-9]*\).*/\1/'` + cur_target_minor=`sw_vers -productVersion | \ + sed 's/\([0-9]*\)\.\([0-9]*\).*/\2/'` + cur_target="${cur_target_major}.${cur_target_minor}" + if test ${cur_target_major} -eq 10 && \ + test ${cur_target_minor} -ge 3 && \ + test ${cur_target_minor} -le 5 + then + # OS X 10.3 through 10.5 + 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='' + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MACOSX_DEPLOYMENT_TARGET" >&5 +$as_echo "$MACOSX_DEPLOYMENT_TARGET" >&6; } + + # end of Darwin* tests + ;; OSF*) BASECFLAGS="$BASECFLAGS -mieee" ;; @@ -6399,7 +6431,6 @@ if test "$Py_OPT" = 'true' ; then # compile working code using it and both test_distutils and test_gdb are # broken when you do managed to get a toolchain that works with it. People # who want LTO need to use --with-lto themselves. - Py_LTO='true' DEF_MAKE_ALL_RULE="profile-opt" REQUIRE_PGO="yes" DEF_MAKE_RULE="build_all" @@ -8441,7 +8472,6 @@ fi ;; esac - #ARCH_RUN_32BIT="true" fi LIBTOOL_CRUFT=$LIBTOOL_CRUFT" -lSystem -lSystemStubs -arch_only ${MACOSX_DEFAULT_ARCH}" @@ -8618,9 +8648,6 @@ then fi else # building for OS X 10.3 and later - 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" |