]> git.lyx.org Git - lyx.git/blob - config/progtest.m4
fix ugly hack
[lyx.git] / config / progtest.m4
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 General Public
6 # License or the GNU Library General Public License but which still want
7 # to provide support for the GNU gettext functionality.
8 # Please note that the actual code of the GNU gettext library is covered
9 # by the GNU Library General Public License, and the rest of the GNU
10 # gettext package package is covered by the GNU General Public License.
11 # They are *not* in the public domain.
12
13 # serial 2
14
15 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
16 dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
17 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
18 [case "`uname -s 2> /dev/null`" in
19 OS/2)
20   PATH=`echo -E "$PATH" | sed 's+\\\\+/+g'`
21   PATH_IFS=';'
22   EXE_EXT='.exe'
23   CMD_EXT='.cmd'
24   ;;
25 *)
26   PATH_IFS=':'
27   EXE_EXT=''
28   CMD_EXT=''
29   ;;
30 esac]
31 [# Extract the first word of "$2", so it can be a program name with args.
32 set dummy $2; ac_word=[$]2
33 AC_MSG_CHECKING([for $ac_word])
34 AC_CACHE_VAL(ac_cv_path_$1,
35 [case "[$]$1" in
36   /*)
37   ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
38   ;;
39   *)
40   IFS="${IFS=   }"; ac_save_ifs="$IFS"; IFS="${IFS}$PATH_IFS"
41   for ac_dir in ifelse([$5], , $PATH, [$5]); do
42     test -z "$ac_dir" && ac_dir=.
43     if test -f $ac_dir/$ac_word \
44          -o -f $ac_dir/$ac_word$EXE_EXT \
45          -o -f $ac_dir/$ac_word$CMD_EXT; then
46       if [$3]; then
47         ac_cv_path_$1="$ac_dir/$ac_word"
48         break
49       fi
50     fi
51   done
52   IFS="$ac_save_ifs"
53 dnl If no 4th arg is given, leave the cache variable unset,
54 dnl so AC_PATH_PROGS will keep looking.
55 ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
56 ])dnl
57   ;;
58 esac])dnl
59 $1="$ac_cv_path_$1"
60 if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
61   AC_MSG_RESULT([$]$1)
62 else
63   AC_MSG_RESULT(no)
64 fi
65 AC_SUBST($1)dnl
66 ])