]>
Commit | Line | Data |
---|---|---|
1 | # Search path for a program which passes the given test. | |
2 | # Ulrich Drepper <drepper@cygnus.com>, 1996. | |
3 | # | |
4 | # This file can be copied and used freely without restrictions. It can | |
5 | # be used in projects which are not available under the GNU Public License | |
6 | # but which still want to provide support for the GNU gettext functionality. | |
7 | # Please note that the actual code is *not* freely available. | |
8 | ||
9 | # serial 1 | |
10 | ||
11 | dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, | |
12 | dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) | |
13 | AC_DEFUN(AM_PATH_PROG_WITH_TEST, | |
14 | [# Extract the first word of "$2", so it can be a program name with args. | |
15 | set dummy $2; ac_word=[$]2 | |
16 | AC_MSG_CHECKING([for $ac_word]) | |
17 | AC_CACHE_VAL(ac_cv_path_$1, | |
18 | [case "[$]$1" in | |
19 | /*) | |
20 | ac_cv_path_$1="[$]$1" # Let the user override the test with a path. | |
21 | ;; | |
22 | *) | |
23 | IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" | |
24 | for ac_dir in ifelse([$5], , $PATH, [$5]); do | |
25 | test -z "$ac_dir" && ac_dir=. | |
26 | if test -f $ac_dir/$ac_word; then | |
27 | if [$3]; then | |
28 | ac_cv_path_$1="$ac_dir/$ac_word" | |
29 | break | |
30 | fi | |
31 | fi | |
32 | done | |
33 | IFS="$ac_save_ifs" | |
34 | dnl If no 4th arg is given, leave the cache variable unset, | |
35 | dnl so AC_PATH_PROGS will keep looking. | |
36 | ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" | |
37 | ])dnl | |
38 | ;; | |
39 | esac])dnl | |
40 | $1="$ac_cv_path_$1" | |
41 | if test -n "[$]$1"; then | |
42 | AC_MSG_RESULT([$]$1) | |
43 | else | |
44 | AC_MSG_RESULT(no) | |
45 | fi | |
46 | AC_SUBST($1)dnl | |
47 | ]) |