jpayne@68
|
1 # progtest.m4 serial 10 (gettext-0.23)
|
jpayne@68
|
2 dnl Copyright (C) 1996-2003, 2005, 2008-2024 Free Software Foundation, Inc.
|
jpayne@68
|
3 dnl This file is free software; the Free Software Foundation
|
jpayne@68
|
4 dnl gives unlimited permission to copy and/or distribute it,
|
jpayne@68
|
5 dnl with or without modifications, as long as this notice is preserved.
|
jpayne@68
|
6 dnl
|
jpayne@68
|
7 dnl This file can be used in projects which are not available under
|
jpayne@68
|
8 dnl the GNU General Public License or the GNU Lesser General Public
|
jpayne@68
|
9 dnl License but which still want to provide support for the GNU gettext
|
jpayne@68
|
10 dnl functionality.
|
jpayne@68
|
11 dnl Please note that the actual code of the GNU gettext library is covered
|
jpayne@68
|
12 dnl by the GNU Lesser General Public License, and the rest of the GNU
|
jpayne@68
|
13 dnl gettext package is covered by the GNU General Public License.
|
jpayne@68
|
14 dnl They are *not* in the public domain.
|
jpayne@68
|
15
|
jpayne@68
|
16 dnl Authors:
|
jpayne@68
|
17 dnl Ulrich Drepper <drepper@cygnus.com>, 1996.
|
jpayne@68
|
18
|
jpayne@68
|
19 AC_PREREQ([2.53])
|
jpayne@68
|
20
|
jpayne@68
|
21 # Search path for a program which passes the given test.
|
jpayne@68
|
22
|
jpayne@68
|
23 dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
|
jpayne@68
|
24 dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
|
jpayne@68
|
25 AC_DEFUN([AM_PATH_PROG_WITH_TEST],
|
jpayne@68
|
26 [
|
jpayne@68
|
27 # Prepare PATH_SEPARATOR.
|
jpayne@68
|
28 # The user is always right.
|
jpayne@68
|
29 if test "${PATH_SEPARATOR+set}" != set; then
|
jpayne@68
|
30 # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
|
jpayne@68
|
31 # contains only /bin. Note that ksh looks also at the FPATH variable,
|
jpayne@68
|
32 # so we have to set that as well for the test.
|
jpayne@68
|
33 PATH_SEPARATOR=:
|
jpayne@68
|
34 (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|
jpayne@68
|
35 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
|
jpayne@68
|
36 || PATH_SEPARATOR=';'
|
jpayne@68
|
37 }
|
jpayne@68
|
38 fi
|
jpayne@68
|
39
|
jpayne@68
|
40 # Find out how to test for executable files. Don't use a zero-byte file,
|
jpayne@68
|
41 # as systems may use methods other than mode bits to determine executability.
|
jpayne@68
|
42 cat >conf$$.file <<_ASEOF
|
jpayne@68
|
43 #! /bin/sh
|
jpayne@68
|
44 exit 0
|
jpayne@68
|
45 _ASEOF
|
jpayne@68
|
46 chmod +x conf$$.file
|
jpayne@68
|
47 if test -x conf$$.file >/dev/null 2>&1; then
|
jpayne@68
|
48 ac_executable_p="test -x"
|
jpayne@68
|
49 else
|
jpayne@68
|
50 ac_executable_p="test -f"
|
jpayne@68
|
51 fi
|
jpayne@68
|
52 rm -f conf$$.file
|
jpayne@68
|
53
|
jpayne@68
|
54 # Extract the first word of "$2", so it can be a program name with args.
|
jpayne@68
|
55 set dummy $2; ac_word=[$]2
|
jpayne@68
|
56 AC_MSG_CHECKING([for $ac_word])
|
jpayne@68
|
57 AC_CACHE_VAL([ac_cv_path_$1],
|
jpayne@68
|
58 [case "[$]$1" in
|
jpayne@68
|
59 [[\\/]]* | ?:[[\\/]]*)
|
jpayne@68
|
60 ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
|
jpayne@68
|
61 ;;
|
jpayne@68
|
62 *)
|
jpayne@68
|
63 gt_saved_IFS="$IFS"; IFS=$PATH_SEPARATOR
|
jpayne@68
|
64 for ac_dir in m4_if([$5], , $PATH, [$5]); do
|
jpayne@68
|
65 IFS="$gt_saved_IFS"
|
jpayne@68
|
66 test -z "$ac_dir" && ac_dir=.
|
jpayne@68
|
67 for ac_exec_ext in '' $ac_executable_extensions; do
|
jpayne@68
|
68 if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
|
jpayne@68
|
69 echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
|
jpayne@68
|
70 if [$3]; then
|
jpayne@68
|
71 ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
|
jpayne@68
|
72 break 2
|
jpayne@68
|
73 fi
|
jpayne@68
|
74 fi
|
jpayne@68
|
75 done
|
jpayne@68
|
76 done
|
jpayne@68
|
77 IFS="$gt_saved_IFS"
|
jpayne@68
|
78 dnl If no 4th arg is given, leave the cache variable unset,
|
jpayne@68
|
79 dnl so AC_PATH_PROGS will keep looking.
|
jpayne@68
|
80 m4_if([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
|
jpayne@68
|
81 ])dnl
|
jpayne@68
|
82 ;;
|
jpayne@68
|
83 esac])dnl
|
jpayne@68
|
84 $1="$ac_cv_path_$1"
|
jpayne@68
|
85 if test m4_if([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
|
jpayne@68
|
86 AC_MSG_RESULT([$][$1])
|
jpayne@68
|
87 else
|
jpayne@68
|
88 AC_MSG_RESULT([no])
|
jpayne@68
|
89 fi
|
jpayne@68
|
90 AC_SUBST([$1])dnl
|
jpayne@68
|
91 ])
|