On tis, 2012-05-08 at 11:33 -0400, Clay McClure wrote:
> "The gist of it is to grab python-config --prefix and store it in a
> variable, say py_prefix. If the file $py_prefix/Python exists, you are
> dealing with a Framework build and -framework Python is the
> appropriate method of linking. Otherwise, you have a UNIX-style build
> and -lpython is the appropriate method of linking."

Please try the attached patch.  It's completely untested, as I don't
have that platform, but as a guidance about how it might work.

diff --git i/config/python.m4 w/config/python.m4
index baa7136..d051203 100644
--- i/config/python.m4
+++ w/config/python.m4
@@ -79,6 +79,15 @@ fi
 
 python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
 
+case $host_os in darwin*)
+  python_prefix=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.PREFIX)"`
+  if test -f "$python_prefix/Python"; then
+    python_libspec='-framework Python'
+    python_additional_libs=
+  fi
+  ;;
+esac
+
 AC_MSG_RESULT([${python_libspec} ${python_additional_libs}])
 
 AC_SUBST(python_libdir)[]dnl
diff --git i/configure w/configure
index 60db1f7..5859b51 100755
--- i/configure
+++ w/configure
@@ -7387,6 +7387,15 @@ fi
 
 python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
 
+case $host_os in darwin*)
+  python_prefix=`${PYTHON} -c "import distutils.sysconfig; print(distutils.sysconfig.PREFIX)"`
+  if test -f "$python_prefix/Python"; then
+    python_libspec='-framework Python'
+    python_additional_libs=
+  fi
+  ;;
+esac
+
 { $as_echo "$as_me:$LINENO: result: ${python_libspec} ${python_additional_libs}" >&5
 $as_echo "${python_libspec} ${python_additional_libs}" >&6; }
 
diff --git i/src/pl/plpython/Makefile w/src/pl/plpython/Makefile
index af6b459..e6a72fb 100644
--- i/src/pl/plpython/Makefile
+++ w/src/pl/plpython/Makefile
@@ -23,9 +23,9 @@ endif
 
 # Darwin (OS X) has its own ideas about how to do this.
 ifeq ($(PORTNAME), darwin)
+ifneq(,$(filter -framework,$(python_libspec)))
 shared_libpython = yes
-override python_libspec = -framework Python
-override python_additional_libs =
+endif
 endif
 
 # If we don't have a shared library and the platform doesn't allow it
-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to