The compilers in OSX would be setup towards compiling for Mac OS X. Instead of trying to muddle with compiler settings in your Mac system, you might be better off to boot the Mac into a Linux system, and use that to compile your program. Thus, less setting up.
However, it probably wouldn't be that much faster. A lot of the time taken during compiling is for disk access, for files needed during the compile. And three hours to compile a Linux kernel is not at all unusual.