Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b55f62a

Browse files
committed
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
1 parent 4b8ee4e commit b55f62a

File tree

5 files changed

+13
-23
lines changed

5 files changed

+13
-23
lines changed

config/python.m4

+5-10
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,11 @@ else
120120
found_shlib=0
121121
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
122122
do
123-
# Note: DLSUFFIX is for loadable modules, not shared
124-
# libraries, so cannot be used here portably. Just
125-
# check all known possibilities.
126-
for e in .so .dll .dylib .sl; do
127-
if test -e "$d/lib${ldlibrary}$e"; then
128-
python_libdir="$d"
129-
found_shlib=1
130-
break 2
131-
fi
132-
done
123+
if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then
124+
python_libdir="$d"
125+
found_shlib=1
126+
break 2
127+
fi
133128
done
134129
# Some platforms (OpenBSD) require us to accept a bare versioned shlib
135130
# (".so.n.n") as well. However, check this only after failing to find

configure

+5-10
Original file line numberDiff line numberDiff line change
@@ -10570,16 +10570,11 @@ else
1057010570
found_shlib=0
1057110571
for d in "${python_libdir}" "${python_configdir}" /usr/lib64 /usr/lib
1057210572
do
10573-
# Note: DLSUFFIX is for loadable modules, not shared
10574-
# libraries, so cannot be used here portably. Just
10575-
# check all known possibilities.
10576-
for e in .so .dll .dylib .sl; do
10577-
if test -e "$d/lib${ldlibrary}$e"; then
10578-
python_libdir="$d"
10579-
found_shlib=1
10580-
break 2
10581-
fi
10582-
done
10573+
if test -e "$d/lib${ldlibrary}${DLSUFFIX}"; then
10574+
python_libdir="$d"
10575+
found_shlib=1
10576+
break 2
10577+
fi
1058310578
done
1058410579
# Some platforms (OpenBSD) require us to accept a bare versioned shlib
1058510580
# (".so.n.n") as well. However, check this only after failing to find

src/Makefile.shlib

-2
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ endif
118118
ifeq ($(PORTNAME), darwin)
119119
ifdef soname
120120
# linkable library
121-
DLSUFFIX = .dylib
122121
ifneq ($(SO_MAJOR_VERSION), 0)
123122
version_link = -compatibility_version $(SO_MAJOR_VERSION) -current_version $(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
124123
endif
@@ -127,7 +126,6 @@ ifeq ($(PORTNAME), darwin)
127126
shlib_major = lib$(NAME).$(SO_MAJOR_VERSION)$(DLSUFFIX)
128127
else
129128
# loadable module
130-
DLSUFFIX = .so
131129
LINK.shared = $(COMPILER) -bundle -multiply_defined suppress
132130
endif
133131
BUILD.exports = $(AWK) '/^[^\#]/ {printf "_%s\n",$$1}' $< >$@

src/makefiles/Makefile.darwin

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ else
1010
endif
1111

1212
# Rule for building a shared library from a single .o file
13-
%.so: %.o
13+
%$(DLSUFFIX): %.o
1414
$(CC) $(CFLAGS) $< $(LDFLAGS) $(LDFLAGS_SL) -bundle $(BE_DLLLIBS) -o $@

src/template/darwin

+2
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,5 @@ case $host_os in
5555
USE_SYSV_SEMAPHORES=1
5656
;;
5757
esac
58+
59+
DLSUFFIX=".dylib"

0 commit comments

Comments
 (0)