bpo-30411: Use --git-dir instead of -C to make git work under version below 1.8.5. (GH-8744)

(cherry picked from commit 4c8555773a801f957297132a92c0acb382d640e4)

Co-authored-by: Xiang Zhang <angwerzx@126.com>
diff --git a/configure.ac b/configure.ac
index b7edbf3..e6ebb43 100644
--- a/configure.ac
+++ b/configure.ac
@@ -39,9 +39,9 @@
 fi
 if test $HAS_GIT = found
 then
-    GITVERSION="git -C \$(srcdir) rev-parse --short HEAD"
-    GITTAG="git -C \$(srcdir) describe --all --always --dirty"
-    GITBRANCH="git -C \$(srcdir) name-rev --name-only HEAD"
+    GITVERSION="git --git-dir \$(srcdir)/.git rev-parse --short HEAD"
+    GITTAG="git --git-dir \$(srcdir)/.git describe --all --always --dirty"
+    GITBRANCH="git --git-dir \$(srcdir)/.git name-rev --name-only HEAD"
 else
     GITVERSION=""
     GITTAG=""