-AC_CHECK_PROGS(GIT_CONFIG, [git-config git-repo-config])
-if test "${ac_cv_prog_GIT_CONFIG}" = ""; then
- AC_CHECK_PROGS(GIT, [git])
- GIT_CONFIG="${ac_cv_prog_GIT} config"
-fi
+
+AC_CHECK_PROG(GIT, [git], [git], [AC_ERROR([git not found])])
+AC_MSG_CHECKING([which config command git supports])
+GIT_CONFIG="git repo-config"
+git config --list >/dev/null && GIT_CONFIG="git config"
+AC_MSG_RESULT([$GIT_CONFIG])