Partially backport r63300: Make --with-soname actually work on macOS
r63300 was mainly about changing the default names, but also included a fix for --with-soname to take effect.
So, please partially backport r63300 to 2.3, 2.4 and 2.5 using the attached patches.
Merging this along with #14803 makes --with-soname actually work on macOS.
Also available in: Atom