summaryrefslogtreecommitdiff
path: root/lib/depcomp
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-10-18 13:46:48 +0200
committerStefano Lattarini <stefano.lattarini@gmail.com>2012-11-24 15:52:41 +0100
commitb53a3b016eba7c20e0d445fa6bd8923c7a3334bb (patch)
tree91538cd0d0a2dd4c67c5f5f96a2540679539e16f /lib/depcomp
parent35ef2ffe421130676ee10361dda09bef4785a194 (diff)
downloadautomake-b53a3b016eba7c20e0d445fa6bd8923c7a3334bb.tar.gz
depcomp: don't rely on character ranges working as in C locale
* lib/depcomp (pgcc): Here. Related reorganization, with the unconditional definition of ... ($upper, $lower, $digits, $alnum, $alpha): ... these shell variables. Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Diffstat (limited to 'lib/depcomp')
-rwxr-xr-xlib/depcomp20
1 files changed, 13 insertions, 7 deletions
diff --git a/lib/depcomp b/lib/depcomp
index 8fac1585c..2850339e6 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -61,6 +61,13 @@ tab=' '
# A newline character.
nl='
'
+# Character ranges might be problematic outside the C locale.
+# These definitions help.
+upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
+lower=abcdefghijklmnopqrstuvwxyz
+digits=0123456789
+alpha=${upper}${lower}
+alnum=${alpha}${digits}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
@@ -168,7 +175,6 @@ gcc)
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
@@ -279,8 +285,8 @@ aix)
# Each line is of the form 'foo.o: dependent.h'.
# Do two passes, one to just change these to
# '$object: dependent.h' and one to simply 'dependent.h:'.
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -355,7 +361,7 @@ pgcc)
test "x$dir" = "x$object" && dir=
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
- base=`echo "$source" | sed -e 's|^.*/||' -e 's/\.[-_a-zA-Z0-9]*$//'`
+ base=`echo "$source" | sed -e 's|^.*/||' -e "s/\.[-_$alnum]*$//"`
tmpdepfile=$base.d
# For projects that build the same source file twice into different object
@@ -443,7 +449,7 @@ hp2)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add 'dependent.h:' lines.
sed -ne '2,${
s/^ *//
@@ -505,8 +511,8 @@ tru64)
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
- sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
- sed -e 's,^.*\.[a-z]*:['"$tab"' ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" > "$depfile"
+ sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi