configure: Do not use -no-undefined with sanitizers on darwin
authorMarvin Scholz <epirat07@gmail.com>
Tue, 3 Oct 2017 23:50:42 +0000 (01:50 +0200)
committerMarvin Scholz <epirat07@gmail.com>
Thu, 5 Oct 2017 09:39:03 +0000 (11:39 +0200)
Using sanitizer and no-undefined will cause linker errors on darwin due
to undefined symbols of the sanitizer.

This is adapted from a patch by Filip Roséen.

configure.ac
lib/Makefile.am
modules/audio_output/Makefile.am
modules/common.am
modules/hw/vdpau/Makefile.am
modules/video_output/Makefile.am
src/Makefile.am

index 0230807..f997f08 100644 (file)
@@ -1136,6 +1136,12 @@ AC_CACHE_CHECK([if linker supports -z,defs], [ac_cv_ld_z_defs], [
 ])
 AS_IF([test "${ac_cv_ld_z_defs}" = "no" -o "x$with_sanitizer" != xno], [VLC_RESTORE_FLAGS])
 
+AM_COND_IF([HAVE_DARWIN], [], [
+  AS_IF([test "${with_sanitizer}" = "no"], [
+    AC_SUBST([LDFLAGS_no_undefined], [-no-undefined])
+  ])
+])
+
 dnl Check for __attribute__((packed))
 AC_CACHE_CHECK([for __attribute__((packed))],
   [ac_cv_c_attribute_packed],
index 59571d8..f0060e1 100644 (file)
@@ -60,7 +60,7 @@ libvlc_la_LIBADD = \
        ../src/libvlccore.la ../compat/libcompat.la $(LIBPTHREAD) $(LIBM)
 libvlc_la_LDFLAGS = \
        $(LDFLAGS_libvlc) \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        -version-info 10:0:5 \
        -export-symbols $(srcdir)/libvlc.sym
 libvlc_la_DEPENDENCIES = libvlc.sym
index 4cffed5..9080083 100644 (file)
@@ -42,7 +42,7 @@ libvlc_pulse_la_CPPFLAGS = -DMODULE_STRING=\"pulse\"
 libvlc_pulse_la_CFLAGS = $(AM_CFLAGS) $(PULSE_CFLAGS)
 libvlc_pulse_la_LIBADD = $(PULSE_LIBS) $(LTLIBVLCCORE)
 libvlc_pulse_la_LDFLAGS = \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        -export-symbols-regex ^vlc_pa_ \
        -version-info 0:0:0
 libpulse_plugin_la_SOURCES = audio_output/pulse.c
index 7d3ce16..97ff8f2 100644 (file)
@@ -30,7 +30,7 @@ AM_LDFLAGS = \
        -avoid-version -module \
        -export-symbols-regex ^vlc_entry \
        -shrext $(LIBEXT) \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        $(top_builddir)/compat/libcompat.la $(LTLIBVLCCORE) 
 if HAVE_WIN32
 AM_LDFLAGS += $(top_builddir)/modules/module.rc.lo -Wc,-static
index 0c527cf..6164b88 100644 (file)
@@ -5,7 +5,7 @@ libvlc_vdpau_la_CFLAGS = $(VDPAU_CFLAGS)
 libvlc_vdpau_la_LIBADD = $(X_LIBS) $(X_PRE_LIBS) -lX11 \
        $(LIBDL) $(LIBPTHREAD)
 libvlc_vdpau_la_LDFLAGS = \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        -export-symbols-regex ^vdp_ \
        -version-info 0:0:0
 
index b778249..166edde 100644 (file)
@@ -114,7 +114,7 @@ libvlc_xcb_events_la_SOURCES = \
 libvlc_xcb_events_la_CPPFLAGS = -DMODULE_STRING=\"xcb\"
 libvlc_xcb_events_la_CFLAGS = $(AM_CFLAGS) $(XCB_CFLAGS)
 libvlc_xcb_events_la_LDFLAGS = \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        -export-symbols-regex ^vlc_xcb_ \
        -version-info 0:0:0
 libvlc_xcb_events_la_LIBADD = $(XCB_LIBS) $(LTLIBVLCCORE)
index 87ea540..42b6235 100644 (file)
@@ -462,7 +462,7 @@ endif
 
 libvlccore_la_LDFLAGS = \
        $(LDFLAGS_libvlccore) \
-       -no-undefined \
+       $(LDFLAGS_no_undefined) \
        -export-symbols $(srcdir)/libvlccore.sym \
        -version-info 8:0:0
 libvlccore_la_DEPENDENCIES = libvlccore.sym