summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--configure.ac18
1 files changed, 17 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index 54c9ebd..289a291 100644
--- a/configure.ac
+++ b/configure.ac
@@ -146,8 +146,21 @@ ndbm:ndbm
# Convert database type to mailutils feature
db_type_to_feature() {
- sed -n /^$(echo "$1" | tr A-Z a-z)':/s/.*://p' <<EOF
+ # Normalize the input
+ key=$(echo "$1" | tr A-Z a-z)
+ # Augment db_map with the line "$key:$key" and select from the resulting
+ # input the first entry starting with "$key:". On output, replace it with
+ # the characters that follow : up to the newline.
+ # The first expression looks for the string in the first line of input.
+ # If found, it replaces it and branches to the end of script. The second
+ # expression then has no chance to catch, since the scanning resumes from
+ # line 2. Otherwise, if key is not found in the first line, the second
+ # expression searches for it in the remaining lines.
+ # The default entry "$key:$key" ensures the normalized key is returned
+ # if no match was found.
+ sed -n -e "1s/^$key"'://p;t' -e '1,//{s///p}' <<EOF
$db_map
+$key:$key
EOF
}
@@ -201,6 +214,9 @@ else
feature=$(mailutils info $fl | head -n 1 | sed 's/WITH_//')
if test -n "$feature"; then
DEFAULT_DB_TYPE=$(db_feature_to_type $feature)
+ if test -z "$DEFAULT_DB_TYPE"; then
+ AC_MSG_WARN([can't select database type $feature, falling back to default])
+ fi
fi
fi
if test -n "$DEFAULT_DB_TYPE"; then

Return to:

Send suggestions and report system problems to the System administrator.