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