Fix for issue 7714, ported from the trunk.
diff --git a/configure.in b/configure.in
index 8b0f7df..4459ec3 100644
--- a/configure.in
+++ b/configure.in
@@ -1469,7 +1469,7 @@
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -install_name $(PYTHONFRAMEWORKINSTALLDIR)/Versions/$(VERSION)/$(PYTHONFRAMEWORK)'
     LIBTOOL_CRUFT=$LIBTOOL_CRUFT' -compatibility_version $(VERSION) -current_version $(VERSION)';;
   Darwin/*)
-    gcc_version=`gcc -v 2>&1 |  grep version | cut -d\  -f3`
+    gcc_version=`gcc -dumpversion`
     if test ${gcc_version} '<' 4.0
         then
             LIBTOOL_CRUFT="-lcc_dynamic"