* src/files.c (strsuffix): New.
[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
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
11dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
12dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
13AC_DEFUN(AM_PATH_PROG_WITH_TEST,
14[# Extract the first word of "$2", so it can be a program name with args.
15set dummy $2; ac_word=[$]2
16AC_MSG_CHECKING([for $ac_word])
17AC_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"
34dnl If no 4th arg is given, leave the cache variable unset,
35dnl so AC_PATH_PROGS will keep looking.
36ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
37])dnl
38 ;;
39esac])dnl
40$1="$ac_cv_path_$1"
41if test -n "[$]$1"; then
42 AC_MSG_RESULT([$]$1)
43else
44 AC_MSG_RESULT(no)
45fi
46AC_SUBST($1)dnl
47])