Blame m4/progtest.m4

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