Partial fix for #887242 (link extensions with dynamic_lookup in stead
of hard linking against the framework).
If $MACOSX_DEPLOYMENT_TARGET is set, and >= 10.3, during configure we
setup extensions to link with dynamic lookup. We also record the
value in the Makefile.
Distutils checks whether a value for MACOSX_DEPLOYMENT_TARGET was
recorded in the Makefile, and if it was insists that the current
value matches.
This is only a partial fix because it only applies to 2.4, and the
"two python problem" exists with Python 2.3 shipped with MacOSX 10.3,
which we have no influence over.
diff --git a/configure.in b/configure.in
index 6098454..cd84ea9 100644
--- a/configure.in
+++ b/configure.in
@@ -216,6 +216,12 @@
fi
AC_MSG_RESULT($EXTRAPLATDIR)
+# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
+# it may influence the way we can build extensions, so distutils
+# needs to check it
+AC_SUBST(CONFIGURE_MACOSX_DEPLOYMENT_TARGET)
+CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
+
# checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@@ -1257,7 +1263,7 @@
# No framework. Ignore undefined symbols, assuming they come from Python
LDSHARED="$LDSHARED -undefined suppress"
fi ;;
- Darwin/*)
+ Darwin/1.4*|Darwin/5.*|Darwin/6.*)
LDSHARED='$(CC) $(LDFLAGS) -bundle'
if test "$enable_framework" ; then
# Link against the framework. All externals should be defined.
@@ -1268,6 +1274,27 @@
BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
fi ;;
+ Darwin/*)
+ # Use -undefined dynamic_lookup whenever possible (10.3 and later).
+ # This allows an extension to be used in any Python
+ if test ${MACOSX_DEPLOYMENT_TARGET-10.1} '>' 10.2
+ then
+ LDSHARED='$(CC) $(LDFLAGS) -bundle -undefined dynamic_lookup'
+ BLDSHARED="$LDSHARED"
+ CONFIGURE_MACOSX_DEPLOYMENT_TARGET=$MACOSX_DEPLOYMENT_TARGET
+ else
+ LDSHARED='$(CC) $(LDFLAGS) -bundle'
+ if test "$enable_framework" ; then
+ # Link against the framework. All externals should be defined.
+ BLDSHARED="$LDSHARED "'-Wl,-F. -framework $(PYTHONFRAMEWORK)'
+ LDSHARED="$LDSHARED "'-Wl,-F$(PYTHONFRAMEWORKPREFIX) -framework $(PYTHONFRAMEWORK)'
+ else
+ # No framework, use the Python app as bundle-loader
+ BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
+ LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
+ fi
+ fi
+ ;;
Linux*|GNU*) LDSHARED='$(CC) -shared';;
BSD/OS*/4*) LDSHARED="gcc -shared";;
OpenBSD*|FreeBSD*)