In OS X Snow Leopard (10.6) I used the following lines in ~/.bashrc
to force compilation with clang instead of standard gcc:
# Set Clang as the default compiler for the system
export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
I also (occasionally) had to use the following lines to use llvm-gcc when clang would fail to compile certain things (PostgreSQL was guilty of this for a long time):
# Set LLVM GCC as the default compiler for the system
export CPP='llvm-gcc-4.2'
export CC='llvm-gcc-4.2'
export CXX='llvm-g++'
On OS X Lion (10.7), are these lines still required? Is llvm-gcc (or clang) the default compiler for the system? Or will these lines still need to live in my ~/.bashrc
?
gcc is symlinked to llvm-gcc-4.2 on Lion.
lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 /usr/bin/gcc -> llvm-gcc-4.2
lrwxr-xr-x 1 root wheel 12 Jul 21 20:51 /usr/bin/g++ -> llvm-g++-4.2
You can probably remove those environment variables without much harm.