I\'m sure there must be a way to do this. As you are probably aware the latest versions of Xcode (and in fact I think all versions of Xcode) on Leopard come with GCC 4.0.1 a
Since I need to build things where CC env is ignored and I end up switching often, I wrote a simple minded gcc_select in Python. Thought I may as well post it here. Invoke it with arg either 4.0 or 4.2 or no arg to see current symlinks. Would need modification if you have versions other than 4.0 and 4.2:
#!/usr/bin/python
import sys
import os
os.chdir('/usr/bin')
files = ['cc', 'gcc', 'c++', 'g++']
if '4.0' in sys.argv:
ver = '4.0'
elif '4.2' in sys.argv:
ver = '4.2'
else:
print "Unknown gcc version. Current setting:"
os.system('ls -al %s' % ' '.join(files))
sys.exit(1)
os.system('rm %s' % ' '.join(files))
for f in files:
os.system('ln -s %s-%s %s' % (f, ver, f))
print "Changed to gcc version %s" % ver