configure: introduce FLAT_NAMESPACE_FLAGS

Set FLAT_NAMESPACE_FLAGS to -Wl,-flat_namespace in configure only for
macOS and use it unconditionally in Makefiles.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Pavel Hrdina 2020-04-30 14:34:33 +02:00
parent 83131d9714
commit 9bc09df873
3 changed files with 19 additions and 11 deletions

View File

@ -189,6 +189,19 @@ esac
AC_MSG_RESULT([$VERSION_SCRIPT_FLAGS])
AC_SUBST([VERSION_SCRIPT_FLAGS])
dnl macOS has two-level namespaces by default.
dnl Override it to allow symbol replacement with DYLD_INSERT_LIBRARIES
case "$host" in
*-*-darwin*)
FLAT_NAMESPACE_FLAGS=-Wl,-flat_namespace
;;
* )
FLAT_NAMESPACE_FLAGS=""
;;
esac
AC_MSG_RESULT([$FLAT_NAMESPACE_FLAGS])
AC_SUBST([FLAT_NAMESPACE_FLAGS])
dnl Specify if we rely on ifconfig instead of iproute2 (e.g. in case
dnl we're working on BSD)
want_ifconfig=no

View File

@ -431,13 +431,9 @@ libvirt_la_LDFLAGS = \
-version-info $(LIBVIRT_VERSION_INFO) \
$(LIBVIRT_NODELETE) \
$(NO_UNDEFINED_LDFLAGS) \
$(AM_LDFLAGS)
if WITH_MACOS
# macOS has two-level namespaces by default.
# Override it to allow symbol replacement with DYLD_INSERT_LIBRARIES
libvirt_la_LDFLAGS += -Wl,-flat_namespace
endif WITH_MACOS
libvirt_la_LDFLAGS += $(NULL)
$(FLAT_NAMESPACE_FLAGS) \
$(AM_LDFLAGS) \
$(NULL)
libvirt_la_LIBADD += \
$(DLOPEN_LIBS)
libvirt_la_CFLAGS = -DIN_LIBVIRT $(AM_CFLAGS)

View File

@ -55,10 +55,9 @@ MOCKLIBS_LDFLAGS = -avoid-version \
DRIVERLIB_LDFLAGS = \
-avoid-version \
-rpath /evil/libtool/hack/to/force/shared/lib/creation \
$(MINGW_EXTRA_LDFLAGS)
if WITH_MACOS
DRIVERLIB_LDFLAGS += -Wl,-flat_namespace
endif WITH_MACOS
$(MINGW_EXTRA_LDFLAGS) \
$(FLAT_NAMESPACE_FLAGS) \
$(NULL)
PROBES_O =
if WITH_DTRACE_PROBES