xref: /aosp_15_r20/external/libexif/auto-m4/progtest.m4 (revision 735d6239c16e246968a03ef6e2db00d67bad6cdc)
1*735d6239SKiyoung Kim# progtest.m4 serial 3 (gettext-0.12)
2*735d6239SKiyoung Kimdnl Copyright (C) 1996-2003 Free Software Foundation, Inc.
3*735d6239SKiyoung Kimdnl This file is free software, distributed under the terms of the GNU
4*735d6239SKiyoung Kimdnl General Public License.  As a special exception to the GNU General
5*735d6239SKiyoung Kimdnl Public License, this file may be distributed as part of a program
6*735d6239SKiyoung Kimdnl that contains a configuration script generated by Autoconf, under
7*735d6239SKiyoung Kimdnl the same distribution terms as the rest of that program.
8*735d6239SKiyoung Kimdnl
9*735d6239SKiyoung Kimdnl This file can can be used in projects which are not available under
10*735d6239SKiyoung Kimdnl the GNU General Public License or the GNU Library General Public
11*735d6239SKiyoung Kimdnl License but which still want to provide support for the GNU gettext
12*735d6239SKiyoung Kimdnl functionality.
13*735d6239SKiyoung Kimdnl Please note that the actual code of the GNU gettext library is covered
14*735d6239SKiyoung Kimdnl by the GNU Library General Public License, and the rest of the GNU
15*735d6239SKiyoung Kimdnl gettext package package is covered by the GNU General Public License.
16*735d6239SKiyoung Kimdnl They are *not* in the public domain.
17*735d6239SKiyoung Kim
18*735d6239SKiyoung Kimdnl Authors:
19*735d6239SKiyoung Kimdnl   Ulrich Drepper <[email protected]>, 1996.
20*735d6239SKiyoung Kim
21*735d6239SKiyoung Kim# Search path for a program which passes the given test.
22*735d6239SKiyoung Kim
23*735d6239SKiyoung Kimdnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
24*735d6239SKiyoung Kimdnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
25*735d6239SKiyoung KimAC_DEFUN([AM_PATH_PROG_WITH_TEST],
26*735d6239SKiyoung Kim[
27*735d6239SKiyoung Kim# Prepare PATH_SEPARATOR.
28*735d6239SKiyoung Kim# The user is always right.
29*735d6239SKiyoung Kimif test "${PATH_SEPARATOR+set}" != set; then
30*735d6239SKiyoung Kim  echo "#! /bin/sh" >conf$$.sh
31*735d6239SKiyoung Kim  echo  "exit 0"   >>conf$$.sh
32*735d6239SKiyoung Kim  chmod +x conf$$.sh
33*735d6239SKiyoung Kim  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
34*735d6239SKiyoung Kim    PATH_SEPARATOR=';'
35*735d6239SKiyoung Kim  else
36*735d6239SKiyoung Kim    PATH_SEPARATOR=:
37*735d6239SKiyoung Kim  fi
38*735d6239SKiyoung Kim  rm -f conf$$.sh
39*735d6239SKiyoung Kimfi
40*735d6239SKiyoung Kim
41*735d6239SKiyoung Kim# Find out how to test for executable files. Don't use a zero-byte file,
42*735d6239SKiyoung Kim# as systems may use methods other than mode bits to determine executability.
43*735d6239SKiyoung Kimcat >conf$$.file <<_ASEOF
44*735d6239SKiyoung Kim#! /bin/sh
45*735d6239SKiyoung Kimexit 0
46*735d6239SKiyoung Kim_ASEOF
47*735d6239SKiyoung Kimchmod +x conf$$.file
48*735d6239SKiyoung Kimif test -x conf$$.file >/dev/null 2>&1; then
49*735d6239SKiyoung Kim  ac_executable_p="test -x"
50*735d6239SKiyoung Kimelse
51*735d6239SKiyoung Kim  ac_executable_p="test -f"
52*735d6239SKiyoung Kimfi
53*735d6239SKiyoung Kimrm -f conf$$.file
54*735d6239SKiyoung Kim
55*735d6239SKiyoung Kim# Extract the first word of "$2", so it can be a program name with args.
56*735d6239SKiyoung Kimset dummy $2; ac_word=[$]2
57*735d6239SKiyoung KimAC_MSG_CHECKING([for $ac_word])
58*735d6239SKiyoung KimAC_CACHE_VAL(ac_cv_path_$1,
59*735d6239SKiyoung Kim[case "[$]$1" in
60*735d6239SKiyoung Kim  [[\\/]]* | ?:[[\\/]]*)
61*735d6239SKiyoung Kim    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
62*735d6239SKiyoung Kim    ;;
63*735d6239SKiyoung Kim  *)
64*735d6239SKiyoung Kim    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
65*735d6239SKiyoung Kim    for ac_dir in ifelse([$5], , $PATH, [$5]); do
66*735d6239SKiyoung Kim      IFS="$ac_save_IFS"
67*735d6239SKiyoung Kim      test -z "$ac_dir" && ac_dir=.
68*735d6239SKiyoung Kim      for ac_exec_ext in '' $ac_executable_extensions; do
69*735d6239SKiyoung Kim        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
70*735d6239SKiyoung Kim          if [$3]; then
71*735d6239SKiyoung Kim            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
72*735d6239SKiyoung Kim            break 2
73*735d6239SKiyoung Kim          fi
74*735d6239SKiyoung Kim        fi
75*735d6239SKiyoung Kim      done
76*735d6239SKiyoung Kim    done
77*735d6239SKiyoung Kim    IFS="$ac_save_IFS"
78*735d6239SKiyoung Kimdnl If no 4th arg is given, leave the cache variable unset,
79*735d6239SKiyoung Kimdnl so AC_PATH_PROGS will keep looking.
80*735d6239SKiyoung Kimifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
81*735d6239SKiyoung Kim])dnl
82*735d6239SKiyoung Kim    ;;
83*735d6239SKiyoung Kimesac])dnl
84*735d6239SKiyoung Kim$1="$ac_cv_path_$1"
85*735d6239SKiyoung Kimif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
86*735d6239SKiyoung Kim  AC_MSG_RESULT([$]$1)
87*735d6239SKiyoung Kimelse
88*735d6239SKiyoung Kim  AC_MSG_RESULT(no)
89*735d6239SKiyoung Kimfi
90*735d6239SKiyoung KimAC_SUBST($1)dnl
91*735d6239SKiyoung Kim])
92