Commit ddd4f82c authored by Tom Lane's avatar Tom Lane

In python shlib probe, cater for OpenBSD, which omits the .so symlink.

Most Unix-oid platforms provide a symlink "libfoo.so" -> "libfoo.so.n.n"
to allow the linker to resolve a reference "-lfoo" to a version-numbered
shared library.  OpenBSD has apparently hacked ld(1) to do this internally,
because there are no such symlinks to be found in their library
directories.  Tweak the new code in PGAC_CHECK_PYTHON_EMBED_SETUP to cope.
Per buildfarm member curculio.
parent eb3bc0bd
...@@ -85,6 +85,7 @@ ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's ...@@ -85,6 +85,7 @@ ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's
if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}" if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
then then
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"` ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
found_shlib=1
else else
# Otherwise, guess the base name of the shlib. # Otherwise, guess the base name of the shlib.
# LDVERSION was added in Python 3.2, before that use $python_version. # LDVERSION was added in Python 3.2, before that use $python_version.
...@@ -98,6 +99,7 @@ else ...@@ -98,6 +99,7 @@ else
found_shlib=0 found_shlib=0
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do do
# We don't know the platform DLSUFFIX here, so check 'em all.
for e in .so .dll .dylib .sl; do for e in .so .dll .dylib .sl; do
if test -e "$d/lib${ldlibrary}$e"; then if test -e "$d/lib${ldlibrary}$e"; then
python_libdir="$d" python_libdir="$d"
...@@ -106,12 +108,28 @@ else ...@@ -106,12 +108,28 @@ else
fi fi
done done
done done
# Some platforms (OpenBSD) require us to accept a bare versioned shlib
# (".so.n.n") as well. However, check this only after failing to find
# ".so" anywhere, because yet other platforms (Debian) put the .so
# symlink in a different directory from the underlying versioned shlib.
if test "$found_shlib" != 1; then if test "$found_shlib" != 1; then
AC_MSG_ERROR([could not find shared library for Python for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do
for f in "$d/lib${ldlibrary}.so."* ; do
if test -e "$f"; then
python_libdir="$d"
found_shlib=1
break 2
fi
done
done
fi
fi
if test "$found_shlib" != 1; then
AC_MSG_ERROR([could not find shared library for Python
You might have to rebuild your Python installation. Refer to the You might have to rebuild your Python installation. Refer to the
documentation for details. Use --without-python to disable building documentation for details. Use --without-python to disable building
PL/Python.]) PL/Python.])
fi
fi fi
python_libspec="-L${python_libdir} -l${ldlibrary}" python_libspec="-L${python_libdir} -l${ldlibrary}"
......
...@@ -7628,6 +7628,7 @@ ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's ...@@ -7628,6 +7628,7 @@ ldlibrary=`echo "${python_ldlibrary}" | sed -e 's/\.so$//' -e 's/\.dll$//' -e 's
if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}" if test -e "${python_libdir}/${python_ldlibrary}" -a x"${python_ldlibrary}" != x"${ldlibrary}"
then then
ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"` ldlibrary=`echo "${ldlibrary}" | sed "s/^lib//"`
found_shlib=1
else else
# Otherwise, guess the base name of the shlib. # Otherwise, guess the base name of the shlib.
# LDVERSION was added in Python 3.2, before that use $python_version. # LDVERSION was added in Python 3.2, before that use $python_version.
...@@ -7641,6 +7642,7 @@ else ...@@ -7641,6 +7642,7 @@ else
found_shlib=0 found_shlib=0
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do do
# We don't know the platform DLSUFFIX here, so check 'em all.
for e in .so .dll .dylib .sl; do for e in .so .dll .dylib .sl; do
if test -e "$d/lib${ldlibrary}$e"; then if test -e "$d/lib${ldlibrary}$e"; then
python_libdir="$d" python_libdir="$d"
...@@ -7649,12 +7651,28 @@ else ...@@ -7649,12 +7651,28 @@ else
fi fi
done done
done done
# Some platforms (OpenBSD) require us to accept a bare versioned shlib
# (".so.n.n") as well. However, check this only after failing to find
# ".so" anywhere, because yet other platforms (Debian) put the .so
# symlink in a different directory from the underlying versioned shlib.
if test "$found_shlib" != 1; then if test "$found_shlib" != 1; then
as_fn_error $? "could not find shared library for Python for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
do
for f in "$d/lib${ldlibrary}.so."* ; do
if test -e "$f"; then
python_libdir="$d"
found_shlib=1
break 2
fi
done
done
fi
fi
if test "$found_shlib" != 1; then
as_fn_error $? "could not find shared library for Python
You might have to rebuild your Python installation. Refer to the You might have to rebuild your Python installation. Refer to the
documentation for details. Use --without-python to disable building documentation for details. Use --without-python to disable building
PL/Python." "$LINENO" 5 PL/Python." "$LINENO" 5
fi
fi fi
python_libspec="-L${python_libdir} -l${ldlibrary}" python_libspec="-L${python_libdir} -l${ldlibrary}"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment