From 81866b6f7ea9801ce8c5f061bd5d94b1d799e03e Mon Sep 17 00:00:00 2001 From: Brendan O'Dea Date: Sat, 26 Jul 2014 15:00:33 +1000 Subject: Add a helper script to locate files in $VPATH --- build-aux/find-vpath | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 build-aux/find-vpath (limited to 'build-aux') 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" -- cgit v1.2.1