diff --git a/Makefile.am b/Makefile.am
index f8ee99d8e541883b70eb2ff8327bae98f0921dcb..755b07f03acfa839dd45c0fde4396ba9ecc9586a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -462,7 +462,15 @@ DEPENDENCIES_vlc = lib/libvlc.a $(L_builtin) $(DATA_win32_rc) $(LIB_intl)
 
 vlc$(EXEEXT): $(vlc_OBJECTS) $(DEPENDENCIES_vlc)
 	@rm -f $(srcdir)/vlc$(EXEEXT)
+if HAVE_BEOS
+	$(CXXLINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
+else
+if HAVE_DARWIN
+	$(CXXLINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
+else
 	$(LINK) $(vlc_LDFLAGS) $(vlc_OBJECTS) $(vlc_LDADD) $(LIBS)
+endif
+endif
 
 if HAVE_BEOS
 	xres -o $@ $(srcdir)/share/vlc_beos.rsrc