summaryrefslogtreecommitdiff
path: root/config/python.m4
diff options
context:
space:
mode:
authorPeter Eisentraut2013-01-05 13:56:14 +0000
committerPeter Eisentraut2013-01-05 13:56:14 +0000
commitfc8745070a53469a43ecbf999dc5692a36a649cc (patch)
tree37576ca6e7172b822af95e732631d8ba8e5f5685 /config/python.m4
parent7e938e3c56590899bcfa587ad0220869cb9be951 (diff)
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.
Diffstat (limited to 'config/python.m4')
-rw-r--r--config/python.m414
1 files changed, 11 insertions, 3 deletions
diff --git a/config/python.m4 b/config/python.m4
index 663ccf9d309..af4d8d715b2 100644
--- a/config/python.m4
+++ b/config/python.m4
@@ -48,7 +48,6 @@ AC_MSG_RESULT([$python_includespec])
AC_SUBST(python_majorversion)[]dnl
AC_SUBST(python_version)[]dnl
-AC_SUBST(python_configdir)[]dnl
AC_SUBST(python_includespec)[]dnl
])# _PGAC_CHECK_PYTHON_DIRS
@@ -69,8 +68,14 @@ 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 x"${python_libdir}" != x"" -a x"${python_ldlibrary}" != x"" -a x"${python_ldlibrary}" != x"${ldlibrary}"
+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}"
then
# New way: use the official shared library
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
@@ -86,13 +91,16 @@ else
python_libspec="-L${python_libdir} -lpython${python_ldversion}"
fi
-python_additional_libs=`${PYTHON} -c "import distutils.sysconfig; print(' '.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','BASEMODLIBS'))))"`
+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
AC_MSG_RESULT([${python_libspec} ${python_additional_libs}])
AC_SUBST(python_libdir)[]dnl
AC_SUBST(python_libspec)[]dnl
AC_SUBST(python_additional_libs)[]dnl
+AC_SUBST(python_enable_shared)[]dnl
# threaded python is not supported on OpenBSD
AC_MSG_CHECKING(whether Python is compiled with thread support)