diff options
Diffstat (limited to 'conf/m4/plptools/PLP_FIND_FILE.m4')
-rw-r--r-- | conf/m4/plptools/PLP_FIND_FILE.m4 | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/conf/m4/plptools/PLP_FIND_FILE.m4 b/conf/m4/plptools/PLP_FIND_FILE.m4 new file mode 100644 index 0000000..868b2d5 --- /dev/null +++ b/conf/m4/plptools/PLP_FIND_FILE.m4 @@ -0,0 +1,17 @@ +dnl +dnl Select first existing file from a list of given files +dnl Usage: +dnl PLP_FIND_FILE(filea fileb filec, FOUND) +dnl +dnl On return, variable FOUND is set to one of fileX or to NO, if none +dnl was found. +dnl +AC_DEFUN(PLP_FIND_FILE,[ + $2=NO + for i in $1; do + if test -r "$i" ; then + $2=$i + break 2 + fi + done +]) |