It appears we don't currently support building on Darwin with GCC that doesn't come from Apple (e.g. the stock GCC).
The main problem appears to be that Apple's GCC supports some flags that stock GCC doesn't (such as -arch). Unfortunately, we rely on these flags thus prohibiting compilation on stock GCC.
It appears Apple has stopped shipping actual GCC with XCode (they switched to LLVM/Clang and the transparent GCC bridge). So, we have to decide if we want to support building on Darwin with the true GCC or make the switch to Clang.
Steps to reproduce:
1) Install a non-Apple GCC. If using HomeBrew, `brew -v install --use-gcc https://github.com/adamv/homebrew-alt/blob/master/duplicates/gcc.rb --enable-all-languages`
2) Try to compile m-c. Define "CC=/usr/local/bin/gcc-4.6 CXX=/usr/local/bin/gcc-4.6" in your .mozconfig
3) make -C config export
/usr/local/bin/gcc-4.6 -arch x86_64 -o now.o -c -Wall -fno-common -isysroot /Developer/SDKs/MacOSX10.7.sdk -O2 -g -fPIC -UNDEBUG -DDEBUG_gps -DMOZILLA_CLIENT=1 -DDEBUG=1 -DHAVE_VISIBILITY_HIDDEN_ATTRIBUTE=1 -DHAVE_VISIBILITY_PRAGMA=1 -DXP_UNIX=1 -DDARWIN=1 -DHAVE_BSD_FLOCK=1 -DHAVE_SOCKLEN_T=1 -DXP_MACOSX=1 -DHAVE_LCHOWN=1 -DHAVE_STRERROR=1 -DFORCE_PR_LOG -D_PR_PTHREADS -UHAVE_CVAR_BUILT_ON_SEM /Users/gps/src/services-central-git/nsprpub/config/now.c
gcc-4.6: error: x86_64: No such file or directory
gcc-4.6: error: unrecognized option '-arch'
By removing '-arch' from a few key places, I was able to unwedge the build. However, js/ is blowing up during linking of the shell: http://gps.pastebin.mozilla.org/1376868
Interestingly, it does produce libjs_static.a just fine. It seems to be missing an input library for linking.
I think we're going to switch to clang and this will be WONTFIX.
You will have a hard time getting apple's new headers to work with upstream gcc. There is a new version of objective c that is not supported upstream and blocks (which we use already on 10.7) is also not supported.
This is unfortunate, but fair, I suppose.
I've updated the Troubleshooting section https://developer.mozilla.org/En/Developer_Guide/Build_Instructions/Mac_OS_X_Prerequisites to reference this. I also took the liberty of refactoring the page, as the content was a bit stale and wasn't very easy to follow, IMO. Peer review would be appreciated.
I'm going to file a follow-up bug to have configure perform better compiler detection. IMO, we should fail fast and not get beyond configure if non-Apple GCC is being used on Darwin.