From fc8745070a53469a43ecbf999dc5692a36a649cc Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 5 Jan 2013 08:56:14 -0500 Subject: PL/Python: Make build on OS X more flexible The PL/Python build on OS X was previously hardcoded to use the system installation of Python, ignoring whatever was specified to configure. Except that it would use the header files from configure, which could lead to mismatches. It was not possible to build against a custom Python installation. Now, we check in configure how the specified Python installation was built and use that, supporting framework and non-framework builds. --- src/Makefile.global.in | 2 +- src/pl/plpython/Makefile | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/Makefile.global.in b/src/Makefile.global.in index 9cc14dae683..ecfb80147f5 100644 --- a/src/Makefile.global.in +++ b/src/Makefile.global.in @@ -175,11 +175,11 @@ enable_dtrace = @enable_dtrace@ enable_coverage = @enable_coverage@ enable_thread_safety = @enable_thread_safety@ +python_enable_shared = @python_enable_shared@ python_includespec = @python_includespec@ python_libdir = @python_libdir@ python_libspec = @python_libspec@ python_additional_libs = @python_additional_libs@ -python_configdir = @python_configdir@ python_majorversion = @python_majorversion@ python_version = @python_version@ diff --git a/src/pl/plpython/Makefile b/src/pl/plpython/Makefile index afd8dea17ef..e9b5e3c065f 100644 --- a/src/pl/plpython/Makefile +++ b/src/pl/plpython/Makefile @@ -5,13 +5,20 @@ top_builddir = ../../.. include $(top_builddir)/src/Makefile.global -# On some platforms we can only build PL/Python if libpython is a -# shared library. Since there is no official way to determine this -# (at least not in pre-2.3 Python), we see if there is a file that is -# named like a shared library. +# We need libpython as a shared library. In Python >=2.5, configure +# 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.) +ifeq (1,$(python_enable_shared)) +shared_libpython = yes +else ifneq (,$(wildcard $(python_libdir)/libpython*$(DLSUFFIX)*)) shared_libpython = yes 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 @@ -21,13 +28,6 @@ python_includespec := $(subst \,/,$(python_includespec)) override python_libspec = endif -# Darwin (OS X) has its own ideas about how to do this. -ifeq ($(PORTNAME), darwin) -shared_libpython = yes -override python_libspec = -framework Python -override python_additional_libs = -endif - # If we don't have a shared library, we have to skip it. ifeq ($(shared_libpython),yes) -- cgit v1.2.3