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