Override default "gcc-4.2" compiler from 10.6's system Perl, since it may not even be present if Xcode 4.2 is installed.
"gcc" and "g++" should be available regardless of the Xcode version.
Reapply for additional issues with tar hanging when running as root. Thanks to Peter Dyballa for the original suggestion.