diff --git a/modules/common.am b/modules/common.am
index c3b3f8ef571bc35c3348f64a2b4149e7e89de6c0..9ac292901c42dc948680b46ccf48777f855b7820 100644
--- a/modules/common.am
+++ b/modules/common.am
@@ -15,7 +15,7 @@ CLEANFILES = $(BUILT_SOURCES)
 LTLIBVLCCORE = $(top_builddir)/src/libvlccore.la
 
 # Module name from object or executable file name.
-MODULE_NAME = $$(p="$@"; p="$${p\#\#*/}"; p="$${p\#lib}"; p="$${p%_plugin*}"; p="$${p%.lo}"; echo "$$p")
+MODULE_NAME = $$(p="$@"; p="$${p\#\#*/}"; p="$${p\#lib}"; p="$${p%_plugin*}"; p="$${p//-/\_}"; p="$${p%.lo}"; echo "$$p")
 
 AM_CPPFLAGS = -DMODULE_STRING=\"$(MODULE_NAME)\"
 if HAVE_DYNAMIC_PLUGINS