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.
This commit is contained in:
Jack Jansen 2004-06-03 12:41:45 +00:00
parent bc555e386b
commit 6b08a40442
4 changed files with 76 additions and 5 deletions

View File

@ -355,6 +355,18 @@ def _init_posix():
raise DistutilsPlatformError(my_msg) raise DistutilsPlatformError(my_msg)
# On MacOSX we need to check the setting of the environment variable
# MACOSX_DEPLOYMENT_TARGET: configure bases some choices on it so
# it needs to be compatible.
# An alternative would be to force MACOSX_DEPLOYMENT_TARGET to be
# the same as during configure.
if sys.platform == 'darwin' and g.has_key('CONFIGURE_MACOSX_DEPLOYMENT_TARGET'):
cfg_target = g['CONFIGURE_MACOSX_DEPLOYMENT_TARGET']
cur_target = os.getenv('MACOSX_DEPLOYMENT_TARGET', '')
if cfg_target != cur_target:
my_msg = ('$MACOSX_DEPLOYMENT_TARGET mismatch: now "%s" but "%s" during configure'
% (cur_target, cfg_target))
raise DistutilsPlatformError(my_msg)
# On AIX, there are wrong paths to the linker scripts in the Makefile # On AIX, there are wrong paths to the linker scripts in the Makefile
# -- these paths are relative to the Python source, but when installed # -- these paths are relative to the Python source, but when installed

View File

@ -107,6 +107,9 @@ PYTHONFRAMEWORK= @PYTHONFRAMEWORK@
PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@ PYTHONFRAMEWORKDIR= @PYTHONFRAMEWORKDIR@
PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@ PYTHONFRAMEWORKPREFIX= @PYTHONFRAMEWORKPREFIX@
PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@ PYTHONFRAMEWORKINSTALLDIR= @PYTHONFRAMEWORKINSTALLDIR@
# Deployment target selected during configure, to be checked
# by distutils
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@
# Options to enable prebinding (for fast startup) # Options to enable prebinding (for fast startup)
OTHER_LIBTOOL_OPT = -prebind -seg1addr 0x10000000 OTHER_LIBTOOL_OPT = -prebind -seg1addr 0x10000000

35
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh #! /bin/sh
# From configure.in Revision: 1.454 . # From configure.in Revision: 1.455 .
# Guess values for system-dependent variables and create Makefiles. # Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57 for python 2.4. # Generated by GNU Autoconf 2.57 for python 2.4.
# #
@ -309,7 +309,7 @@ ac_includes_default="\
# include <unistd.h> # include <unistd.h>
#endif" #endif"
ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS' ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION SOVERSION CONFIG_ARGS PYTHONFRAMEWORK PYTHONFRAMEWORKDIR PYTHONFRAMEWORKPREFIX PYTHONFRAMEWORKINSTALLDIR MACHDEP SGI_ABI EXTRAPLATDIR EXTRAMACHDEPPATH CONFIGURE_MACOSX_DEPLOYMENT_TARGET CXX MAINOBJ EXEEXT CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC OBJEXT CPP EGREP BUILDEXEEXT LIBRARY LDLIBRARY DLLLIBRARY BLDLIBRARY LDLIBRARYDIR INSTSONAME RUNSHARED LINKCC RANLIB ac_ct_RANLIB AR INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LN OPT BASECFLAGS LIBTOOL_CRUFT SO LDSHARED BLDSHARED CCSHARED LINKFORSHARED CFLAGSFORSHARED SHLIBS USE_SIGNAL_MODULE SIGNAL_OBJS USE_THREAD_MODULE LDLAST THREADOBJ DLINCLDIR DYNLOADFILE MACHDEP_OBJS TRUE LIBOBJS HAVE_GETHOSTBYNAME_R_6_ARG HAVE_GETHOSTBYNAME_R_5_ARG HAVE_GETHOSTBYNAME_R_3_ARG HAVE_GETHOSTBYNAME_R HAVE_GETHOSTBYNAME LIBM LIBC UNICODE_OBJS THREADHEADERS SRCDIRS LTLIBOBJS'
ac_subst_files='' ac_subst_files=''
# Initialize some variables set by options. # Initialize some variables set by options.
@ -1442,6 +1442,7 @@ case $ac_sys_system/$ac_sys_release in
define_xopen_source=no;; define_xopen_source=no;;
# On UnixWare 7, u_long is never defined with _XOPEN_SOURCE, # On UnixWare 7, u_long is never defined with _XOPEN_SOURCE,
# but used in /usr/include/netinet/tcp.h. Reported by Tim Rice. # but used in /usr/include/netinet/tcp.h. Reported by Tim Rice.
# Reconfirmed for 7.1.4 by Martin v. Loewis.
OpenUNIX/8.0.0| UnixWare/7.1.[0-4]) OpenUNIX/8.0.0| UnixWare/7.1.[0-4])
define_xopen_source=no;; define_xopen_source=no;;
# On OpenServer 5, u_short is never defined with _XOPEN_SOURCE, # On OpenServer 5, u_short is never defined with _XOPEN_SOURCE,
@ -1527,6 +1528,12 @@ fi
echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5 echo "$as_me:$LINENO: result: $EXTRAPLATDIR" >&5
echo "${ECHO_T}$EXTRAPLATDIR" >&6 echo "${ECHO_T}$EXTRAPLATDIR" >&6
# Record the configure-time value of MACOSX_DEPLOYMENT_TARGET,
# it may influence the way we can build extensions, so distutils
# needs to check it
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=
# checks for alternative programs # checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@ -9392,7 +9399,7 @@ then
# No framework. Ignore undefined symbols, assuming they come from Python # No framework. Ignore undefined symbols, assuming they come from Python
LDSHARED="$LDSHARED -undefined suppress" LDSHARED="$LDSHARED -undefined suppress"
fi ;; fi ;;
Darwin/*) Darwin/1.4*|Darwin/5.*|Darwin/6.*)
LDSHARED='$(CC) $(LDFLAGS) -bundle' LDSHARED='$(CC) $(LDFLAGS) -bundle'
if test "$enable_framework" ; then if test "$enable_framework" ; then
# Link against the framework. All externals should be defined. # Link against the framework. All externals should be defined.
@ -9403,6 +9410,27 @@ then
BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
fi ;; 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';; Linux*|GNU*) LDSHARED='$(CC) -shared';;
BSD/OS*/4*) LDSHARED="gcc -shared";; BSD/OS*/4*) LDSHARED="gcc -shared";;
OpenBSD*|FreeBSD*) OpenBSD*|FreeBSD*)
@ -18662,6 +18690,7 @@ s,@MACHDEP@,$MACHDEP,;t t
s,@SGI_ABI@,$SGI_ABI,;t t s,@SGI_ABI@,$SGI_ABI,;t t
s,@EXTRAPLATDIR@,$EXTRAPLATDIR,;t t s,@EXTRAPLATDIR@,$EXTRAPLATDIR,;t t
s,@EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t s,@EXTRAMACHDEPPATH@,$EXTRAMACHDEPPATH,;t t
s,@CONFIGURE_MACOSX_DEPLOYMENT_TARGET@,$CONFIGURE_MACOSX_DEPLOYMENT_TARGET,;t t
s,@CXX@,$CXX,;t t s,@CXX@,$CXX,;t t
s,@MAINOBJ@,$MAINOBJ,;t t s,@MAINOBJ@,$MAINOBJ,;t t
s,@EXEEXT@,$EXEEXT,;t t s,@EXEEXT@,$EXEEXT,;t t

View File

@ -216,6 +216,12 @@ then
fi fi
AC_MSG_RESULT($EXTRAPLATDIR) 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 # checks for alternative programs
# compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just # compiler flags are generated in two sets, BASECFLAGS and OPT. OPT is just
@ -1257,7 +1263,7 @@ then
# No framework. Ignore undefined symbols, assuming they come from Python # No framework. Ignore undefined symbols, assuming they come from Python
LDSHARED="$LDSHARED -undefined suppress" LDSHARED="$LDSHARED -undefined suppress"
fi ;; fi ;;
Darwin/*) Darwin/1.4*|Darwin/5.*|Darwin/6.*)
LDSHARED='$(CC) $(LDFLAGS) -bundle' LDSHARED='$(CC) $(LDFLAGS) -bundle'
if test "$enable_framework" ; then if test "$enable_framework" ; then
# Link against the framework. All externals should be defined. # Link against the framework. All externals should be defined.
@ -1268,6 +1274,27 @@ then
BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)' BLDSHARED="$LDSHARED "'-bundle_loader $(BUILDPYTHON)'
LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)' LDSHARED="$LDSHARED "'-bundle_loader $(BINDIR)/python$(VERSION)$(EXE)'
fi ;; 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';; Linux*|GNU*) LDSHARED='$(CC) -shared';;
BSD/OS*/4*) LDSHARED="gcc -shared";; BSD/OS*/4*) LDSHARED="gcc -shared";;
OpenBSD*|FreeBSD*) OpenBSD*|FreeBSD*)