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