Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit be95462

Browse files
committed
After discussion on the PythonMac-SIG it was decided that it is better
to make using "-undefined dynamic_lookup" for linking extensions more automatic on 10.3 and later. So if we're on that platform and MACOSX_DEPLOYMENT_TARGET is not set we now set it to the current OSX version during configure. Additionally, distutils will pick up the configure-time value by default. Will backport.
1 parent 6116f07 commit be95462

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

Lib/distutils/sysconfig.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,11 +360,13 @@ def _init_posix():
360360
# On MacOSX we need to check the setting of the environment variable
361361
# MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
362362
# it needs to be compatible.
363-
# An alternative would be to force MACOSX_DEPLOYMENT_TARGET to be
364-
# the same as during configure.
363+
# If it isn't set we set it to the configure-time value
365364
if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'):
366365
cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET']
367366
cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
367+
if cur_target == '':
368+
cur_target = cfg_target
369+
os.putenv('MACOSX_DEPLOYMENT_TARGET', cfg_target)
368370
if cfg_target != cur_target:
369371
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure'
370372
% (cur_target, cfg_target))

configure

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.475 .
2+
# From configure.in Revision: 1.477 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.59 for python 2.5.
55
#
@@ -10322,11 +10322,12 @@ then
1032210322
Darwin/*)
1032310323
# Use -undefined dynamic_lookup whenever possible (10.3 and later).
1032410324
# This allows an extension to be used in any Python
10325-
if test ${MACOSX_DEPLOYMENT_TARGET-10.1} '>' 10.2
10325+
cur_target=`sw_vers -productVersion | sed 's/\(10\.[0-9]*\).*/\1/'`
10326+
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
1032610327
then
1032710328
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
1032810329
BLDSHARED="$LDSHARED"
10329-
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
10330+
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
1033010331
else
1033110332
LDSHARED='$(CC) $(LDFLAGS) -bundle'
1033210333
if test "$enable_framework" ; then

configure.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,11 +1324,12 @@ then
13241324
Darwin/*)
13251325
# Use -undefined dynamic_lookup whenever possible (10.3 and later).
13261326
# This allows an extension to be used in any Python
1327-
if test ${MACOSX_DEPLOYMENT_TARGET-10.1} '>' 10.2
1327+
cur_target=`sw_vers -productVersion | sed 's/\(10\.[[0-9]]*\).*/\1/'`
1328+
if test ${MACOSX_DEPLOYMENT_TARGET-${cur_target}} '>' 10.2
13281329
then
13291330
LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
13301331
BLDSHARED="$LDSHARED"
1331-
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
1332+
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET-${cur_target}}
13321333
else
13331334
LDSHARED='$(CC) $(LDFLAGS) -bundle'
13341335
if test "$enable_framework" ; then

0 commit comments

Comments
 (0)