diff options
author | Brendan O'Dea <bod@debian.org> | 2014-07-26 15:00:33 +1000 |
---|---|---|
committer | Brendan O'Dea <bod@debian.org> | 2014-07-26 15:00:33 +1000 |
commit | 81866b6f7ea9801ce8c5f061bd5d94b1d799e03e (patch) | |
tree | 3da4e5be208d5bf4ef98b7dd05b831150bae2ed1 /build-aux | |
parent | b4cbd8cd6e742fee1f3f5ca25a734756b1bfe0be (diff) | |
download | help2man-81866b6f7ea9801ce8c5f061bd5d94b1d799e03e.tar.gz |
Add a helper script to locate files in $VPATH
Diffstat (limited to 'build-aux')
-rwxr-xr-x | build-aux/find-vpath | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/build-aux/find-vpath b/build-aux/find-vpath new file mode 100755 index 0000000..9f85ed3 --- /dev/null +++ b/build-aux/find-vpath @@ -0,0 +1,38 @@ +#!/bin/sh + +# Locate file in $VPATH. + +if [ $# != 1 ] +then + echo "Usage: find-vpath FILE" >&2 + exit 2 +fi + +file="$1" +IFS=: +for dir in ${VPATH:-.} +do + if [ x"$dir" = x ] || [ x"$dir" = x. ] + then + path=$file + else + path="$dir/$file" + fi + + if [ -f "$path" ] + then + echo "$path" + exit 0 + fi +done + +# This is typically called from make like: +# +# $(INSTALL_DATA) `build-aux/find-file-vpath something` $(DESTDIR)$(somedir) +# +# so we should return something which will result in a useful error +# message from the install program ("can't find something"), rather +# than a usage message since it was called with the wrong number of +# arguments. + +echo "$file" |