Blame m4/progtest.m4

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