]> granicus.if.org Git - postgresql/commitdiff
On OS X, link libpython normally, ignoring the "framework" framework.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 May 2014 22:18:11 +0000 (18:18 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 30 May 2014 22:19:06 +0000 (18:19 -0400)
As of Xcode 5.0, Apple isn't including the Python framework as part of the
SDK-level files, which means that linking to it might fail depending on
whether Xcode thinks you've selected a specific SDK version.  According to
their Tech Note 2328, they've basically deprecated the framework method of
linking to libpython and are telling people to link to the shared library
normally.  (I'm pretty sure this is in direct contradiction to the advice
they were giving a few years ago, but whatever.)  Testing says that this
approach works fine at least as far back as OS X 10.4.11, so let's just
rip out the framework special case entirely.  We do still need a special
case to decide that OS X provides a shared library at all, unfortunately
(I wonder why the distutils check doesn't work ...).  But this is still
less of a special case than before, so it's fine.

Back-patch to all supported branches, since we'll doubtless be hearing
about this more as more people update to recent Xcode.

config/python.m4
configure
src/pl/plpython/Makefile

index 5cb285489b1127c54884cb97363463aa909740b7..7012c536d796eede25f1189e5bf701812c6f1978 100644 (file)
@@ -68,14 +68,9 @@ python_libdir=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(N
 python_ldlibrary=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LDLIBRARY'))))"`
 python_so=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('SO'))))"`
 ldlibrary=`echo "${python_ldlibrary}" | sed "s/${python_so}$//"`
-python_framework=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('PYTHONFRAMEWORK'))))"`
 python_enable_shared=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_vars().get('Py_ENABLE_SHARED',0))"`
 
-if test -n "$python_framework"; then
-       python_frameworkprefix=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('PYTHONFRAMEWORKPREFIX'))))"`
-       python_libspec="-F${python_frameworkprefix} -framework $python_framework"
-       python_enable_shared=1
-elif test x"${python_libdir}" != x"" -a x"${python_ldlibrary}" != x"" -a x"${python_ldlibrary}" != x"${ldlibrary}"
+if test x"${python_libdir}" != x"" -a x"${python_ldlibrary}" != x"" -a x"${python_ldlibrary}" != x"${ldlibrary}"
 then
        # New way: use the official shared library
        ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
@@ -91,9 +86,7 @@ else
        python_libspec="-L${python_libdir} -lpython${python_ldversion}"
 fi
 
-if test -z "$python_framework"; then
-       python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
-fi
+python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
 
 AC_MSG_RESULT([${python_libspec} ${python_additional_libs}])
 
index 3663e50d15005b2cecf43682dc49c4cec1317535..646b3fc417b1380d04590f4c599da97a9b36befb 100755 (executable)
--- a/configure
+++ b/configure
@@ -7375,14 +7375,9 @@ python_libdir=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(N
 python_ldlibrary=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LDLIBRARY'))))"`
 python_so=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('SO'))))"`
 ldlibrary=`echo "${python_ldlibrary}" | sed "s/${python_so}$//"`
-python_framework=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('PYTHONFRAMEWORK'))))"`
 python_enable_shared=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_vars().get('Py_ENABLE_SHARED',0))"`
 
-if test -n "$python_framework"; then
-       python_frameworkprefix=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('PYTHONFRAMEWORKPREFIX'))))"`
-       python_libspec="-F${python_frameworkprefix} -framework $python_framework"
-       python_enable_shared=1
-elif test x"${python_libdir}" != x"" -a x"${python_ldlibrary}" != x"" -a x"${python_ldlibrary}" != x"${ldlibrary}"
+if test x"${python_libdir}" != x"" -a x"${python_ldlibrary}" != x"" -a x"${python_ldlibrary}" != x"${ldlibrary}"
 then
        # New way: use the official shared library
        ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
@@ -7398,9 +7393,7 @@ else
        python_libspec="-L${python_libdir} -lpython${python_ldversion}"
 fi
 
-if test -z "$python_framework"; then
-       python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
-fi
+python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${python_libspec} ${python_additional_libs}" >&5
 $as_echo "${python_libspec} ${python_additional_libs}" >&6; }
index 46d2030d698b5a0d338c3bc2b0bb920c610be032..020861a4f8bed75bcdeb0683ef113c558be66a0e 100644 (file)
@@ -9,16 +9,19 @@ include $(top_builddir)/src/Makefile.global
 # asks Python directly.  But because this has been broken in Debian
 # for a long time (http://bugs.debian.org/695979), and to support
 # older Python versions, we see if there is a file that is named like
-# a shared library as a fallback.  (Note that this is wrong on OS X,
-# where DLSUFFIX is .so, but libpython is a .dylib.  Python <2.5 is
-# therefore not supported on OS X.)
+# a shared library as a fallback.
 ifeq (1,$(python_enable_shared))
 shared_libpython = yes
 else
+ifeq ($(PORTNAME), darwin)
+# OS X does supply a .dylib even though Py_ENABLE_SHARED does not get set
+shared_libpython = yes
+else
 ifneq (,$(wildcard $(python_libdir)/libpython*$(DLSUFFIX)*))
 shared_libpython = yes
 endif
 endif
+endif
 
 # Windows needs to convert backslashed paths to normal slashes,
 # and we have to remove -lpython from the link since we are building our own