1# $Id$
2# (c) 2002 Martin Preuss<martin@libchipcard.de>
3# These functions search for files
4
5
6AC_DEFUN([AQ_SEARCH_FOR_PATH],[
7dnl searches for a file in a path
8dnl $1 = file to search
9dnl $2 = paths to search in
10dnl returns the directory where the file is found (found_dir)
11found_dir=""
12ls=$1
13ld="$2"
14for li in $ld; do
15    case "$build" in
16      *-win32*) fname="$li\\$ls" ;;
17      *)        fname="$li/$ls"  ;;
18    esac
19
20    if test -r "$fname"; then
21        found_dir="$li"
22        break
23    fi
24done
25])
26
27AC_DEFUN([AQ_SEARCH_FILES],[
28dnl searches a dir for some files
29dnl $1 = path where to search
30dnl $2 = files to find
31dnl returns the name of the file found (found_file)
32found_file=""
33ls="$1"
34ld="$2"
35lf=""
36for li in $ld; do
37    lf2="`ls -d ${ls}/${li} 2>/dev/null`"
38    lf="$lf $lf2"
39done
40for li in $lf; do
41    if test -r "$li"; then
42	found_file=`basename "$li"`
43	break
44    fi
45done
46])
47