diff options
author | Michal Suchanek | 2012-09-07 12:55:48 +0200 |
---|---|---|
committer | Michal Suchanek | 2012-09-07 12:58:37 +0200 |
commit | 3b4f1aeeccb985fcb97e1fcd1df6c050e169dfb3 (patch) | |
tree | 48698f4fb7a449f0201e87e2617a3583759c353a /configure.ac | |
parent | mount: fix man pahe typo in quota mount option names (diff) | |
download | kernel-qcow2-util-linux-3b4f1aeeccb985fcb97e1fcd1df6c050e169dfb3.tar.gz kernel-qcow2-util-linux-3b4f1aeeccb985fcb97e1fcd1df6c050e169dfb3.tar.xz kernel-qcow2-util-linux-3b4f1aeeccb985fcb97e1fcd1df6c050e169dfb3.zip |
Fix configure to work with multiarch distributions.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index ead559c30..2ae34ef8d 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,30 @@ case $prefix:$localstatedir in esac AC_SUBST([localstatedir]) -libdirname=`basename "$libdir"` +# sed_quote separator string +# Prefixes occurences of sed special characters and separator with \ in string. +# Suggested separators: , / (space) . +# Note that the character is prefixed with \ so characters that get special meaning +# will not work as separator. eg: n \ ? ( { ) } +sed_quote() +{ + echo -n "$2" | sed -e 's/\n/\\n/' -e 's|\([][*.$|'"$1"']\)|\\\1|g' +} + +# remove_dir_prefix prefix path +# Remove leading path prefix. +# Return directory name without leading slash (basename drop-in). +# Handle prefix trailing slash. +# // (double slash) is not handled. +remove_dir_prefix(){ + local prefix="$(sed_quote "," "$1")" + echo "$1" | grep -q '/$' || prefix="${prefix}/" + local re="^$(sed_quote "," "$prefix")" + echo "$2" | grep -q "$re" || re=/ + echo "$2" | sed -e "s,${re},," +} + +libdirname=`remove_dir_prefix '${exec_prefix}' "$libdir"` AC_SUBST([libdirname]) # The original default values of {bin,sbin,lib}dir |