summaryrefslogtreecommitdiff
path: root/build-aux
diff options
context:
space:
mode:
authorBrendan O'Dea <bod@debian.org>2014-07-26 15:00:33 +1000
committerBrendan O'Dea <bod@debian.org>2014-07-26 15:00:33 +1000
commit81866b6f7ea9801ce8c5f061bd5d94b1d799e03e (patch)
tree3da4e5be208d5bf4ef98b7dd05b831150bae2ed1 /build-aux
parentb4cbd8cd6e742fee1f3f5ca25a734756b1bfe0be (diff)
downloadhelp2man-81866b6f7ea9801ce8c5f061bd5d94b1d799e03e.tar.gz
Add a helper script to locate files in $VPATH
Diffstat (limited to 'build-aux')
-rwxr-xr-xbuild-aux/find-vpath38
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"