Blame m4/progtest.m4

Packit fc043f
# progtest.m4 serial 7 (gettext-0.18.2)
Packit fc043f
dnl Copyright (C) 1996-2003, 2005, 2008-2014 Free Software Foundation, Inc.
Packit fc043f
dnl This file is free software; the Free Software Foundation
Packit fc043f
dnl gives unlimited permission to copy and/or distribute it,
Packit fc043f
dnl with or without modifications, as long as this notice is preserved.
Packit fc043f
dnl
Packit fc043f
dnl This file can can be used in projects which are not available under
Packit fc043f
dnl the GNU General Public License or the GNU Library General Public
Packit fc043f
dnl License but which still want to provide support for the GNU gettext
Packit fc043f
dnl functionality.
Packit fc043f
dnl Please note that the actual code of the GNU gettext library is covered
Packit fc043f
dnl by the GNU Library General Public License, and the rest of the GNU
Packit fc043f
dnl gettext package package is covered by the GNU General Public License.
Packit fc043f
dnl They are *not* in the public domain.
Packit fc043f
Packit fc043f
dnl Authors:
Packit fc043f
dnl   Ulrich Drepper <drepper@cygnus.com>, 1996.
Packit fc043f
Packit fc043f
AC_PREREQ([2.50])
Packit fc043f
Packit fc043f
# Search path for a program which passes the given test.
Packit fc043f
Packit fc043f
dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR,
Packit fc043f
dnl   TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]])
Packit fc043f
AC_DEFUN([AM_PATH_PROG_WITH_TEST],
Packit fc043f
[
Packit fc043f
# Prepare PATH_SEPARATOR.
Packit fc043f
# The user is always right.
Packit fc043f
if test "${PATH_SEPARATOR+set}" != set; then
Packit fc043f
  # Determine PATH_SEPARATOR by trying to find /bin/sh in a PATH which
Packit fc043f
  # contains only /bin. Note that ksh looks also at the FPATH variable,
Packit fc043f
  # so we have to set that as well for the test.
Packit fc043f
  PATH_SEPARATOR=:
Packit fc043f
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
Packit fc043f
    && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \
Packit fc043f
           || PATH_SEPARATOR=';'
Packit fc043f
       }
Packit fc043f
fi
Packit fc043f
Packit fc043f
# Find out how to test for executable files. Don't use a zero-byte file,
Packit fc043f
# as systems may use methods other than mode bits to determine executability.
Packit fc043f
cat >conf$$.file <<_ASEOF
Packit fc043f
#! /bin/sh
Packit fc043f
exit 0
Packit fc043f
_ASEOF
Packit fc043f
chmod +x conf$$.file
Packit fc043f
if test -x conf$$.file >/dev/null 2>&1; then
Packit fc043f
  ac_executable_p="test -x"
Packit fc043f
else
Packit fc043f
  ac_executable_p="test -f"
Packit fc043f
fi
Packit fc043f
rm -f conf$$.file
Packit fc043f
Packit fc043f
# Extract the first word of "$2", so it can be a program name with args.
Packit fc043f
set dummy $2; ac_word=[$]2
Packit fc043f
AC_MSG_CHECKING([for $ac_word])
Packit fc043f
AC_CACHE_VAL([ac_cv_path_$1],
Packit fc043f
[case "[$]$1" in
Packit fc043f
  [[\\/]]* | ?:[[\\/]]*)
Packit fc043f
    ac_cv_path_$1="[$]$1" # Let the user override the test with a path.
Packit fc043f
    ;;
Packit fc043f
  *)
Packit fc043f
    ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR
Packit fc043f
    for ac_dir in ifelse([$5], , $PATH, [$5]); do
Packit fc043f
      IFS="$ac_save_IFS"
Packit fc043f
      test -z "$ac_dir" && ac_dir=.
Packit fc043f
      for ac_exec_ext in '' $ac_executable_extensions; do
Packit fc043f
        if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then
Packit fc043f
          echo "$as_me: trying $ac_dir/$ac_word..." >&AS_MESSAGE_LOG_FD
Packit fc043f
          if [$3]; then
Packit fc043f
            ac_cv_path_$1="$ac_dir/$ac_word$ac_exec_ext"
Packit fc043f
            break 2
Packit fc043f
          fi
Packit fc043f
        fi
Packit fc043f
      done
Packit fc043f
    done
Packit fc043f
    IFS="$ac_save_IFS"
Packit fc043f
dnl If no 4th arg is given, leave the cache variable unset,
Packit fc043f
dnl so AC_PATH_PROGS will keep looking.
Packit fc043f
ifelse([$4], , , [  test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4"
Packit fc043f
])dnl
Packit fc043f
    ;;
Packit fc043f
esac])dnl
Packit fc043f
$1="$ac_cv_path_$1"
Packit fc043f
if test ifelse([$4], , [-n "[$]$1"], ["[$]$1" != "$4"]); then
Packit fc043f
  AC_MSG_RESULT([$][$1])
Packit fc043f
else
Packit fc043f
  AC_MSG_RESULT([no])
Packit fc043f
fi
Packit fc043f
AC_SUBST([$1])dnl
Packit fc043f
])