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