From 03bd1f8fbee3c996741e308d317a37a2f6d8ddef Mon Sep 17 00:00:00 2001
From: Christian Engwer <christi@dune-project.org>
Date: Thu, 21 Dec 2006 11:21:03 +0000
Subject: [PATCH] fixed bug #225 and improved error messages

[[Imported from SVN: r4820]]
---
 bin/dunecontrol     |  2 ++
 bin/dunemodules.inc | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/bin/dunecontrol b/bin/dunecontrol
index 10fba0757..b9b4045b4 100755
--- a/bin/dunecontrol
+++ b/bin/dunecontrol
@@ -297,6 +297,7 @@ while test $# -gt 0; do
         echo  > /dev/stderr
         exit 1;
       fi
+      export NAME_`fix_variable_name $arg`="$arg"
       fix_and_assign MODULE "$arg"
     ;;
     --only=*)
@@ -306,6 +307,7 @@ while test $# -gt 0; do
         echo  > /dev/stderr
         exit 1;
       fi
+      export NAME_`fix_variable_name $arg`="$arg"
       fix_and_assign ONLY "$arg"
       fix_and_assign MODULE "$arg"
     ;;
diff --git a/bin/dunemodules.inc b/bin/dunemodules.inc
index 5995e6609..9adf3fe1d 100644
--- a/bin/dunemodules.inc
+++ b/bin/dunemodules.inc
@@ -118,7 +118,7 @@ sort_modules() {
     if test "x$(eval echo \$HAVE_$m)" != "x"; then
       _sort_module $m
     else
-      echo "ERROR: could not find module $dep" > /dev/stderr
+      echo "ERROR: could not find module $(eval echo \$NAME_$m)" > /dev/stderr
       exit 1
     fi
   done
@@ -144,7 +144,7 @@ _sort_module() {
     for name in $(eval "echo \$DEPS_$module"); do
 	  dep=$(fix_variable_name $name)
       if ! check_modname $dep; then 
-        echo "ERROR: invalid module name $dep" > /dev/stderr
+        echo "ERROR: invalid module name $name" > /dev/stderr
         exit 1
       fi
       if test "x$(eval echo \$HAVE_$dep)" != "x"; then
@@ -153,7 +153,7 @@ _sort_module() {
         # perhaps this module is installed,
         # then it should be handled via pkg-config
         if ! pkg-config $name; then
-          echo "ERROR: could not find module $dep" > /dev/stderr
+          echo "ERROR: could not find module $(eval echo \$NAME_$dep)" > /dev/stderr
           echo "       module is also unknown to pkg-config" > /dev/stderr
           exit 1
         fi
@@ -163,7 +163,7 @@ _sort_module() {
     for name in $(eval "echo \$SUGS_$module"); do
 	  dep=$(fix_variable_name $name)
       if ! check_modname $dep; then
-        echo "ERROR: invalid module name $dep" > /dev/stderr
+        echo "ERROR: invalid module name $name" > /dev/stderr
         exit 1
       fi
       if test "x$(eval echo \$HAVE_$dep)" != "x"; then
@@ -213,7 +213,7 @@ eval_control() {
 # $2 value
 #
 fix_variable_name() {
-  echo "$@" | tr '-' '_'
+  echo -n "$@" | tr '[:punct:]' '__'
 }
 
 fix_and_assign() {
-- 
GitLab