[dunecontrol] Fixes multiarch detection issues.

This patch fixes two issues:
- Faulty an non-posix sed expression
- Precendence issue (multiarch was extracted before compiler was set.)
(cherry picked from commit 8c01107cd6db0ddbc6a1cb1c085e27fc111fe3ca)

Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>
[duneproject] do not convert too many hyphens to underscores

Module names with hyphens are no longer changed to
underscores.
This fixes FS#1432.
(cherry picked from commit a20dd6283ac48c723ff4830fab6ee14ea9132b7b)

Signed-off-by: Christoph Grüninger <gruenich@dune-project.org>