-AC_DEFUN([gcc_AC_CHECK_TOOL], [
-AC_REQUIRE([gcc_AC_TOOL_DIRS])
-AC_REQUIRE([gcc_AC_BUILD_EXEEXT])
-
-dnl shut up useless "checking for..." messages
-dnl we can still read them in config.log
-exec AS_MESSAGE_FD([])>/dev/null
-
-# First try the environment variables. Handle full paths or basenames.
-if test "x[$]$1" = x && test -n "[$]$4"; then
- AC_PATH_PROG($1, [$]$4)
-fi
-if test "x[$]$1" = x && test -n "[$]$5" && test x$host = x$target; then
- AC_PATH_PROG($1, [$]$5)
-fi
-
-if test "x[$]$1" = x; then
- # The AC_PATH_PROGS macro doesn't work properly when its 4th argument
- # is empty.
- if test "x$gcc_cv_tool_dirs" = x; then
- $1=
- else
- AC_PATH_PROGS($1, $2, , $gcc_cv_tool_dirs)
- fi
-fi
-if test "x[$]$1" = x; then
- # If the loop above did not find a tool, then use whatever
- # one we can find in the users's path. We are looking for a
- # ${build} -> ${target} tool.
- if test "x$program_prefix" != xNONE; then
- default_tool_name=${program_prefix}$2
- elif test x$build != x$host && test x$build != x$target; then
- default_tool_name=${target_noncanonical}-$2
- else
- default_tool_name=`echo $2 | sed "${program_transform_name}"`
- fi
- AC_PATH_PROGS($1, $default_tool_name,
- $gcc_cv_tool_prefix/bin/$default_tool_name$build_exeext)
-fi
-test "$silent" != yes && exec AS_MESSAGE_FD([])>&1
-
-$3="[$]$1"
-AC_SUBST($3)])