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