]> git.saurik.com Git - bison.git/blame - m4/progtest.m4
Regen.
[bison.git] / m4 / progtest.m4
CommitLineData
8c44d3ec
AD
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
459dd1a6
AD
5# be used in projects which are not available under the GNU General Public
6# License but which still want to provide support for the GNU gettext
7# functionality.
8# Please note that the actual code of GNU gettext is covered by the GNU
9# General Public License and is *not* in the public domain.
8c44d3ec 10
459dd1a6 11# serial 2
8c44d3ec
AD
12
13dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
14dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
1e24cc5b 15AC_DEFUN([AM_PATH_PROG_WITH_TEST],
8c44d3ec
AD
16[# Extract the first word of "$2", so it can be a program name with args.
17set dummy $2; ac_word=[$]2
18AC_MSG_CHECKING([for $ac_word])
19AC_CACHE_VAL(ac_cv_path_$1,
20[case "[$]$1" in
21 /*)
22 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
23 ;;
24 *)
25 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
26 for ac_dir in ifelse([$5], , $PATH, [$5]); do
27 test -z "$ac_dir" && ac_dir=.
28 if test -f $ac_dir/$ac_word; then
29 if [$3]; then
30 ac_cv_path_$1="$ac_dir/$ac_word"
31 break
32 fi
33 fi
34 done
35 IFS="$ac_save_ifs"
36dnl If no 4th arg is given, leave the cache variable unset,
37dnl so AC_PATH_PROGS will keep looking.
38ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
39])dnl
40 ;;
41esac])dnl
42$1="$ac_cv_path_$1"
459dd1a6 43if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
8c44d3ec
AD
44 AC_MSG_RESULT([$]$1)
45else
46 AC_MSG_RESULT(no)
47fi
48AC_SUBST($1)dnl
49])