8248158: Configure fails with autoconf not found even though it's installed

Reviewed-by: erikj, ihse, stooke
diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4
index 0128930..9f0eea4 100644
--- a/make/autoconf/basic_tools.m4
+++ b/make/autoconf/basic_tools.m4
@@ -72,7 +72,6 @@
   UTIL_REQUIRE_PROGS(UNAME, uname)
   UTIL_REQUIRE_PROGS(UNIQ, uniq)
   UTIL_REQUIRE_PROGS(WC, wc)
-  UTIL_REQUIRE_PROGS(WHICH, which)
   UTIL_REQUIRE_PROGS(XARGS, xargs)
 
   # Then required tools that require some special treatment.
diff --git a/make/autoconf/configure b/make/autoconf/configure
index 953ebb6..f635c19 100644
--- a/make/autoconf/configure
+++ b/make/autoconf/configure
@@ -78,11 +78,11 @@
 ###
 
 autoconf_missing_help() {
-  APT_GET="`which apt-get 2> /dev/null | grep -v '^no apt-get in'`"
-  YUM="`which yum 2> /dev/null | grep -v '^no yum in'`"
-  BREW="`which brew 2> /dev/null | grep -v '^no brew in'`"
-  ZYPPER="`which zypper 2> /dev/null | grep -v '^no zypper in'`"
-  CYGWIN="`which cygpath 2> /dev/null | grep -v '^no cygpath in'`"
+  APT_GET="`type -p apt-get 2> /dev/null`"
+  YUM="`type -p yum 2> /dev/null`"
+  BREW="`type -p brew 2> /dev/null`"
+  ZYPPER="`type -p zypper 2> /dev/null`"
+  CYGWIN="`type -p cygpath 2> /dev/null`"
 
   if test "x$ZYPPER" != x; then
     PKGHANDLER_COMMAND="sudo zypper install autoconf"
@@ -111,7 +111,7 @@
       exit 1
     fi
   else
-    AUTOCONF="`which autoconf 2> /dev/null | grep -v '^no autoconf in'`"
+    AUTOCONF="`type -p autoconf 2> /dev/null`"
     if test "x$AUTOCONF" = x; then
       echo
       echo "Autoconf is not found on the PATH, and AUTOCONF is not set."
diff --git a/make/autoconf/util.m4 b/make/autoconf/util.m4
index 3ab9bf5..0addb9c 100644
--- a/make/autoconf/util.m4
+++ b/make/autoconf/util.m4
@@ -601,7 +601,7 @@
   UTIL_SETUP_TOOL($1, [AC_PATH_PROGS($1, $2, , $3)])
   if test "x[$]$1" = x; then
     AC_MSG_NOTICE([Required tool $2 not found in PATH, checking built-in])
-    if command -v $2 > /dev/null 2>&1; then
+    if type -p $2 > /dev/null 2>&1; then
       AC_MSG_NOTICE([Found $2 as shell built-in. Using it])
       $1="$2"
     else
diff --git a/make/autoconf/util_windows.m4 b/make/autoconf/util_windows.m4
index 2785497..868c436 100644
--- a/make/autoconf/util_windows.m4
+++ b/make/autoconf/util_windows.m4
@@ -242,7 +242,7 @@
   new_path=`$CYGPATH -u "$path"`
 
   # Now try to locate executable using which
-  new_path=`$WHICH "$new_path" 2> /dev/null`
+  new_path=`type -p "$new_path" 2> /dev/null`
   # bat and cmd files are not always considered executable in cygwin causing which
   # to not find them
   if test "x$new_path" = x \
@@ -258,7 +258,7 @@
     path="$complete"
     arguments="EOL"
     new_path=`$CYGPATH -u "$path"`
-    new_path=`$WHICH "$new_path" 2> /dev/null`
+    new_path=`type -p "$new_path" 2> /dev/null`
     # bat and cmd files are not always considered executable in cygwin causing which
     # to not find them
     if test "x$new_path" = x \
@@ -324,7 +324,7 @@
   UTIL_REWRITE_AS_UNIX_PATH(new_path)
 
   # Now try to locate executable using which
-  new_path=`$WHICH "$new_path" 2> /dev/null`
+  new_path=`type -p "$new_path" 2> /dev/null`
 
   if test "x$new_path" = x; then
     # Oops. Which didn't find the executable.
@@ -336,7 +336,7 @@
     new_path="$path"
     UTIL_REWRITE_AS_UNIX_PATH(new_path)
 
-    new_path=`$WHICH "$new_path" 2> /dev/null`
+    new_path=`type -p "$new_path" 2> /dev/null`
     # bat and cmd files are not always considered executable in MSYS causing which
     # to not find them
     if test "x$new_path" = x \
@@ -392,7 +392,7 @@
 
   # Now try to locate executable using which
   new_path_bak="$new_path"
-  new_path=`$WHICH "$new_path" 2> /dev/null`
+  new_path=`type -p "$new_path" 2> /dev/null`
   # bat and cmd files are not considered executable in WSL
   if test "x$new_path" = x \
       && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \
@@ -409,7 +409,7 @@
     new_path="$path"
     UTIL_REWRITE_AS_UNIX_PATH([new_path])
     new_path_bak="$new_path"
-    new_path=`$WHICH "$new_path" 2> /dev/null`
+    new_path=`type -p "$new_path" 2> /dev/null`
     # bat and cmd files are not considered executable in WSL
     if test "x$new_path" = x \
         && test "x`$ECHO \"$path\" | $GREP -i -e \"\\.bat$\" -e \"\\.cmd$\"`" != x \