diff options
Diffstat (limited to 'config')
| -rw-r--r-- | config/python.m4 | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/config/python.m4 b/config/python.m4 index 2a61559f8a..17dd085b97 100644 --- a/config/python.m4 +++ b/config/python.m4 @@ -1,7 +1,7 @@ # # Autoconf macros for configuring the build of Python extension modules # -# $PostgreSQL: pgsql/config/python.m4,v 1.10 2004/10/10 19:07:52 tgl Exp $ +# $PostgreSQL: pgsql/config/python.m4,v 1.11 2004/10/11 19:32:16 tgl Exp $ # # PGAC_PATH_PYTHON @@ -18,7 +18,7 @@ fi # _PGAC_CHECK_PYTHON_DIRS # ----------------------- -# Determine the name of various directory of a given Python installation. +# Determine the name of various directories of a given Python installation. AC_DEFUN([_PGAC_CHECK_PYTHON_DIRS], [AC_REQUIRE([PGAC_PATH_PYTHON]) AC_MSG_CHECKING([for Python distutils module]) @@ -44,13 +44,37 @@ AC_MSG_RESULT([$python_configdir]) # PGAC_CHECK_PYTHON_EMBED_SETUP # ----------------------------- +# +# Note: selecting libpython from python_configdir works in all Python +# releases, but it generally finds a non-shared library, which means +# that we are binding the python interpreter right into libplpython.so. +# In Python 2.3 and up there should be a shared library available in +# the main library location. AC_DEFUN([PGAC_CHECK_PYTHON_EMBED_SETUP], [AC_REQUIRE([_PGAC_CHECK_PYTHON_DIRS]) AC_MSG_CHECKING([how to link an embedded Python application]) -python_libspec=`${PYTHON} -c "import distutils.sysconfig,string; print '-lpython${python_version} '+string.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','LOCALMODLIBS','BASEMODLIBS')))"` +python_libdir=`${PYTHON} -c "import distutils.sysconfig,string; print string.join(filter(None,distutils.sysconfig.get_config_vars('LIBDIR')))"` +python_ldlibrary=`${PYTHON} -c "import distutils.sysconfig,string; print string.join(filter(None,distutils.sysconfig.get_config_vars('LDLIBRARY')))"` +python_so=`${PYTHON} -c "import distutils.sysconfig,string; print string.join(filter(None,distutils.sysconfig.get_config_vars('SO')))"` +ldlibrary=`echo "${python_ldlibrary}" | sed "s/${python_so}$//"` + +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//"` + python_libspec="-L${python_libdir} -l${ldlibrary}" +else + # Old way: use libpython from python_configdir + python_libdir="${python_configdir}" + python_libspec="-L${python_libdir} -lpython${python_version}" +fi + +python_additional_libs=`${PYTHON} -c "import distutils.sysconfig,string; print string.join(filter(None,distutils.sysconfig.get_config_vars('LIBS','LIBC','LIBM','LOCALMODLIBS','BASEMODLIBS')))"` -AC_MSG_RESULT([${python_libspec}]) +AC_MSG_RESULT([${python_libspec} ${python_additional_libs}]) +AC_SUBST(python_libdir)[]dnl AC_SUBST(python_libspec)[]dnl +AC_SUBST(python_additional_libs)[]dnl ])# PGAC_CHECK_PYTHON_EMBED_SETUP |
