1153761Swollman# progtest.m4 serial 4 (gettext-0.14.2) 2192886Sedwindnl Copyright (C) 1996-2003, 2005 Free Software Foundation, Inc. 3192886Sedwindnl This file is free software; the Free Software Foundation 4153761Swollmandnl gives unlimited permission to copy and/or distribute it, 52742Swollmandnl with or without modifications, as long as this notice is preserved. 686464Swollmandnl 72742Swollmandnl This file can can be used in projects which are not available under 82742Swollmandnl the GNU General Public License or the GNU Library General Public 92742Swollmandnl License but which still want to provide support for the GNU gettext 102742Swollmandnl functionality. 112742Swollmandnl Please note that the actual code of the GNU gettext library is covered 122742Swollmandnl by the GNU Library General Public License, and the rest of the GNU 1386222Swollmandnl gettext package package is covered by the GNU General Public License. 1486222Swollmandnl They are *not* in the public domain. 152742Swollman 1658787Srudnl Authors: 172742Swollmandnl Ulrich Drepper <drepper@cygnus.com>, 1996. 182742Swollman 192742SwollmanAC_PREREQ(2.50) 202742Swollman 212742Swollman# Search path for a program which passes the given test. 222742Swollman 2358787Srudnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 2458787Srudnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 2558787SruAC_DEFUN([AM_PATH_PROG_WITH_TEST], 262742Swollman[ 272742Swollman# Prepare PATH_SEPARATOR. 289908Swollman# The user is always right. 292742Swollmanif test "${PATH_SEPARATOR+set}" != set; then 3030711Swollman echo "#! /bin/sh" >conf$$.sh 312742Swollman echo "exit 0" >>conf$$.sh 329908Swollman chmod +x conf$$.sh 33169811Swollman if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then 34169811Swollman PATH_SEPARATOR=';' 35169811Swollman else 36169811Swollman PATH_SEPARATOR=: 37169811Swollman fi 38169811Swollman rm -f conf$$.sh 39169811Swollmanfi 40169811Swollman 41169811Swollman# Find out how to test for executable files. Don't use a zero-byte file, 42169811Swollman# as systems may use methods other than mode bits to determine executability. 43169811Swollmancat >conf$$.file <<_ASEOF 442742Swollman#! /bin/sh 4558787Sruexit 0 46169811Swollman_ASEOF 47169811Swollmanchmod +x conf$$.file 48169811Swollmanif test -x conf$$.file >/dev/null 2>&1; then 49169811Swollman ac_executable_p="test -x" 50169811Swollmanelse 519908Swollman ac_executable_p="test -f" 5220094Swollmanfi 53149514Swollmanrm -f conf$$.file 5420094Swollman 5520094Swollman# Extract the first word of "$2", so it can be a program name with args. 5620094Swollmanset dummy $2; ac_word=[$]2 5720094SwollmanAC_MSG_CHECKING([for $ac_word]) 5820094SwollmanAC_CACHE_VAL(ac_cv_path_$1, 5920094Swollman[case "[$]$1" in 6020094Swollman [[\\/]]* | ?:[[\\/]]*) 6120094Swollman ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 6220094Swollman ;; 6320094Swollman *) 6420094Swollman ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR 6558787Sru for ac_dir in ifelse([$5], , $PATH, [$5]); do 6658787Sru IFS="$ac_save_IFS" 6721217Swollman test -z "$ac_dir" && ac_dir=. 6821217Swollman for ac_exec_ext in '' $ac_executable_extensions; do 6958787Sru if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then 7058787Sru echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD 712742Swollman if [$3]; then 7258787Sru ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" 7321217Swollman break 2 7420094Swollman fi 7558787Sru fi 7658787Sru done 7720094Swollman done 782742Swollman IFS="$ac_save_IFS" 799908Swollmandnl If no 4th arg is given, leave the cache variable unset, 802742Swollmandnl so AC_PATH_PROGS will keep looking. 8114343Swollmanifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 8214343Swollman])dnl 83171948Sedwin ;; 8414343Swollmanesac])dnl 8514343Swollman$1="$ac_cv_path_$1" 86218122Sedwinif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 87218122Sedwin AC_MSG_RESULT([$]$1) 88218122Sedwinelse 89218122Sedwin AC_MSG_RESULT(no) 90218122Sedwinfi 91149514SwollmanAC_SUBST($1)dnl 92218122Sedwin]) 93171948Sedwin