1*eda14cbcSMatt Macy# progtest.m4 serial 7 (gettext-0.18.2) 2*eda14cbcSMatt Macydnl Copyright (C) 1996-2003, 2005, 2008-2019 Free Software Foundation, Inc. 3*eda14cbcSMatt Macydnl This file is free software; the Free Software Foundation 4*eda14cbcSMatt Macydnl gives unlimited permission to copy and/or distribute it, 5*eda14cbcSMatt Macydnl with or without modifications, as long as this notice is preserved. 6*eda14cbcSMatt Macydnl 7*eda14cbcSMatt Macydnl This file can be used in projects which are not available under 8*eda14cbcSMatt Macydnl the GNU General Public License or the GNU Library General Public 9*eda14cbcSMatt Macydnl License but which still want to provide support for the GNU gettext 10*eda14cbcSMatt Macydnl functionality. 11*eda14cbcSMatt Macydnl Please note that the actual code of the GNU gettext library is covered 12*eda14cbcSMatt Macydnl by the GNU Library General Public License, and the rest of the GNU 13*eda14cbcSMatt Macydnl gettext package is covered by the GNU General Public License. 14*eda14cbcSMatt Macydnl They are *not* in the public domain. 15*eda14cbcSMatt Macy 16*eda14cbcSMatt Macydnl Authors: 17*eda14cbcSMatt Macydnl Ulrich Drepper <drepper@cygnus.com>, 1996. 18*eda14cbcSMatt Macy 19*eda14cbcSMatt MacyAC_PREREQ([2.50]) 20*eda14cbcSMatt Macy 21*eda14cbcSMatt Macy# Search path for a program which passes the given test. 22*eda14cbcSMatt Macy 23*eda14cbcSMatt Macydnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, 24*eda14cbcSMatt Macydnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) 25*eda14cbcSMatt MacyAC_DEFUN([AM_PATH_PROG_WITH_TEST], 26*eda14cbcSMatt Macy[ 27*eda14cbcSMatt Macy# Prepare PATH_SEPARATOR. 28*eda14cbcSMatt Macy# The user is always right. 29*eda14cbcSMatt Macyif test "${PATH_SEPARATOR+set}" != set; then 30*eda14cbcSMatt Macy # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which 31*eda14cbcSMatt Macy # contains only /bin. Note that ksh looks also at the FPATH variable, 32*eda14cbcSMatt Macy # so we have to set that as well for the test. 33*eda14cbcSMatt Macy PATH_SEPARATOR=: 34*eda14cbcSMatt Macy (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 35*eda14cbcSMatt Macy && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ 36*eda14cbcSMatt Macy || PATH_SEPARATOR=';' 37*eda14cbcSMatt Macy } 38*eda14cbcSMatt Macyfi 39*eda14cbcSMatt Macy 40*eda14cbcSMatt Macy# Find out how to test for executable files. Don't use a zero-byte file, 41*eda14cbcSMatt Macy# as systems may use methods other than mode bits to determine executability. 42*eda14cbcSMatt Macycat >conf$$.file <<_ASEOF 43*eda14cbcSMatt Macy#! /bin/sh 44*eda14cbcSMatt Macyexit 0 45*eda14cbcSMatt Macy_ASEOF 46*eda14cbcSMatt Macychmod +x conf$$.file 47*eda14cbcSMatt Macyif test -x conf$$.file >/dev/null 2>&1; then 48*eda14cbcSMatt Macy ac_executable_p="test -x" 49*eda14cbcSMatt Macyelse 50*eda14cbcSMatt Macy ac_executable_p="test -f" 51*eda14cbcSMatt Macyfi 52*eda14cbcSMatt Macyrm -f conf$$.file 53*eda14cbcSMatt Macy 54*eda14cbcSMatt Macy# Extract the first word of "$2", so it can be a program name with args. 55*eda14cbcSMatt Macyset dummy $2; ac_word=[$]2 56*eda14cbcSMatt MacyAC_MSG_CHECKING([for $ac_word]) 57*eda14cbcSMatt MacyAC_CACHE_VAL([ac_cv_path_$1], 58*eda14cbcSMatt Macy[case "[$]$1" in 59*eda14cbcSMatt Macy [[\\/]]* | ?:[[\\/]]*) 60*eda14cbcSMatt Macy ac_cv_path_$1="[$]$1" # Let the user override the test with a path. 61*eda14cbcSMatt Macy ;; 62*eda14cbcSMatt Macy *) 63*eda14cbcSMatt Macy ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR 64*eda14cbcSMatt Macy for ac_dir in ifelse([$5], , $PATH, [$5]); do 65*eda14cbcSMatt Macy IFS="$ac_save_IFS" 66*eda14cbcSMatt Macy test -z "$ac_dir" && ac_dir=. 67*eda14cbcSMatt Macy for ac_exec_ext in '' $ac_executable_extensions; do 68*eda14cbcSMatt Macy if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then 69*eda14cbcSMatt Macy echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD 70*eda14cbcSMatt Macy if [$3]; then 71*eda14cbcSMatt Macy ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext" 72*eda14cbcSMatt Macy break 2 73*eda14cbcSMatt Macy fi 74*eda14cbcSMatt Macy fi 75*eda14cbcSMatt Macy done 76*eda14cbcSMatt Macy done 77*eda14cbcSMatt Macy IFS="$ac_save_IFS" 78*eda14cbcSMatt Macydnl If no 4th arg is given, leave the cache variable unset, 79*eda14cbcSMatt Macydnl so AC_PATH_PROGS will keep looking. 80*eda14cbcSMatt Macyifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" 81*eda14cbcSMatt Macy])dnl 82*eda14cbcSMatt Macy ;; 83*eda14cbcSMatt Macyesac])dnl 84*eda14cbcSMatt Macy$1="$ac_cv_path_$1" 85*eda14cbcSMatt Macyif test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then 86*eda14cbcSMatt Macy AC_MSG_RESULT([$][$1]) 87*eda14cbcSMatt Macyelse 88*eda14cbcSMatt Macy AC_MSG_RESULT([no]) 89*eda14cbcSMatt Macyfi 90*eda14cbcSMatt MacyAC_SUBST([$1])dnl 91*eda14cbcSMatt Macy]) 92