[configure] Factor out couple of duplicated AC_PATH_PROG calls