mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Improve (I hope) our autolocation of the Python shared library.
Older versions of Python produce garbage (or at least useless) values of
get_config_vars('LDLIBRARY'). Newer versions produce garbage (or at least
useless) values of get_config_vars('SO'), which was defeating our configure
logic that attempted to identify where the Python shlib really is. The net
result, at least with a stock Python 3.5 installation on macOS, was that
we were linking against a static library in the mistaken belief that it was
a shared library. This managed to work, if you count statically absorbing
libpython into plpython.so as working. But it no longer works as of commit
d51924be8
, because now we get separate static copies of libpython in
plpython.so and hstore_plpython.so, and those can't interoperate on the
same data. There are some other infelicities like assuming that nobody
ever installs a private version of Python on a macOS machine.
Hence, forget about looking in $python_configdir for the Python shlib;
as far as I can tell no version of Python has ever put one there, and
certainly no currently-supported version does. Also, rather than relying
on get_config_vars('SO'), just try all the possibilities for shlib
extensions. Also, rather than trusting Py_ENABLE_SHARED, believe we've
found a shlib only if it has a recognized extension. Last, explicitly
cope with the possibility that the shlib is really in /usr/lib and
$python_libdir is a red herring --- this is the actual situation on older
macOS, but we were only accidentally working with it.
Discussion: <5300.1475592228@sss.pgh.pa.us>
This commit is contained in:
34
configure.in
34
configure.in
@ -934,40 +934,6 @@ fi
|
||||
if test "$with_python" = yes; then
|
||||
PGAC_PATH_PYTHON
|
||||
PGAC_CHECK_PYTHON_EMBED_SETUP
|
||||
|
||||
# We need libpython as a shared library. With Python >=2.5, we
|
||||
# check the Py_ENABLE_SHARED setting. On Debian, the setting is not
|
||||
# correct before the jessie release (http://bugs.debian.org/695979).
|
||||
# We also want to support older Python versions. So as a fallback
|
||||
# we see if there is a file that is named like a shared library.
|
||||
|
||||
if test "$python_enable_shared" != 1; then
|
||||
if test "$PORTNAME" = darwin; then
|
||||
# macOS does supply a .dylib even though Py_ENABLE_SHARED does
|
||||
# not get set. The file detection logic below doesn't succeed
|
||||
# on older macOS versions, so make it explicit.
|
||||
python_enable_shared=1
|
||||
elif test "$PORTNAME" = win32; then
|
||||
# Windows also needs an explicit override.
|
||||
python_enable_shared=1
|
||||
else
|
||||
# We don't know the platform shared library extension here yet,
|
||||
# so we try some candidates.
|
||||
for dlsuffix in .so .sl; do
|
||||
if ls "$python_libdir"/libpython*${dlsuffix}* >/dev/null 2>&1; then
|
||||
python_enable_shared=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$python_enable_shared" != 1; then
|
||||
AC_MSG_ERROR([cannot build PL/Python because libpython is not a shared library
|
||||
You might have to rebuild your Python installation. Refer to the
|
||||
documentation for details. Use --without-python to disable building
|
||||
PL/Python.])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "$cross_compiling" = yes && test -z "$with_system_tzdata"; then
|
||||
|
Reference in New Issue
Block a user