Unify DLSUFFIX on Darwin

macOS has traditionally used extension .dylib for shared libraries
(used at build time) and .so for dynamically loaded modules (used by
dlopen()).  This complicates the build system a bit.  Also, Meson uses
.dylib for both, so it would be worth unifying this in order to be
able to get equal build output.

There doesn't appear to be any reason to use any particular extension
for dlopened modules, since dlopen() will accept anything and
PostgreSQL is well-factored to be able to deal with any extension.
Other software packages that I have handy appear to be about 50/50
split on which extension they use for their plugins.  So it seems
possible to change this safely.

Discussion: https://www.postgresql.org/message-id/flat/bcc45f78-e3c3-8fb3-7c42-5371b48b5266%40enterprisedb.com
This commit is contained in:
Peter Eisentraut 2022-07-06 07:30:16 +02:00
parent 4b8ee4e9d3
commit b55f62abb2
5 changed files with 13 additions and 23 deletions

View File

@ -120,17 +120,12 @@ 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
# Note: DLSUFFIX is for loadable modules, not shared if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then
# libraries, so cannot be used here portably. Just
# check all known possibilities.
for e in .so .dll .dylib .sl; do
if test -e "$d/lib${ldlibrary}$e"; then
python_libdir="$d" python_libdir="$d"
found_shlib=1 found_shlib=1
break 2 break 2
fi fi
done done
done
# Some platforms (OpenBSD) require us to accept a bare versioned shlib # 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.n.n") as well. However, check this only after failing to find
# ".so" anywhere, because yet other platforms (Debian) put the .so # ".so" anywhere, because yet other platforms (Debian) put the .so

7
configure vendored
View File

@ -10570,17 +10570,12 @@ 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
# Note: DLSUFFIX is for loadable modules, not shared if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then
# libraries, so cannot be used here portably. Just
# check all known possibilities.
for e in .so .dll .dylib .sl; do
if test -e "$d/lib${ldlibrary}$e"; then
python_libdir="$d" python_libdir="$d"
found_shlib=1 found_shlib=1
break 2 break 2
fi fi
done done
done
# Some platforms (OpenBSD) require us to accept a bare versioned shlib # 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.n.n") as well. However, check this only after failing to find
# ".so" anywhere, because yet other platforms (Debian) put the .so # ".so" anywhere, because yet other platforms (Debian) put the .so

View File

@ -118,7 +118,6 @@ endif
ifeq ($(PORTNAME), darwin) ifeq ($(PORTNAME), darwin)
ifdef soname ifdef soname
# linkable library # linkable library
DLSUFFIX = .dylib
ifneq ($(SO_MAJOR_VERSION), 0) ifneq ($(SO_MAJOR_VERSION), 0)
version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
endif endif
@ -127,7 +126,6 @@ ifeq ($(PORTNAME), darwin)
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX) shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
else else
# loadable module # loadable module
DLSUFFIX = .so
LINK.shared = $(COMPILER) -bundle -multiply_defined suppress LINK.shared = $(COMPILER) -bundle -multiply_defined suppress
endif endif
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@ BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@

View File

@ -10,5 +10,5 @@ else
endif endif
# Rule for building a shared library from a single .o file # Rule for building a shared library from a single .o file
%.so: %.o %$(DLSUFFIX): %.o
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -o $@ $(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -o $@

View File

@ -55,3 +55,5 @@ case $host_os in
USE_SYSV_SEMAPHORES=1 USE_SYSV_SEMAPHORES=1
;; ;;
esac esac
DLSUFFIX=".dylib"