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