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