6 if not 'go' in config.root.llvm_bindings:
7 config.unsupported = True
9 def find_executable(executable, path=None):
11 path = os.environ['PATH']
12 paths = path.split(os.pathsep)
13 base, ext = os.path.splitext(executable)
15 if (sys.platform == 'win32' or os.name == 'os2') and (ext != '.exe'):
16 executable = executable + '.exe'
18 if not os.path.isfile(executable):
20 f = os.path.join(p, executable)
27 # Resolve certain symlinks in the first word of compiler.
29 # This is a Go-specific hack. cgo and other Go tools check $CC and $CXX for the
30 # substring 'clang' to determine if the compiler is Clang. This won't work if
31 # $CC is cc and cc is a symlink pointing to clang, as it is on Darwin.
32 def fixup_compiler_path(compiler):
33 args = shlex.split(compiler)
34 path = find_executable(args[0])
37 if path.endswith('/cc') and os.readlink(path) == 'clang':
38 args[0] = path[:len(path)-2] + 'clang'
43 if path.endswith('/c++') and os.readlink(path) == 'clang++':
44 args[0] = path[:len(path)-3] + 'clang++'
48 return ' '.join([pipes.quote(arg) for arg in args])
50 config.environment['CC'] = fixup_compiler_path(config.host_cc)
51 config.environment['CXX'] = fixup_compiler_path(config.host_cxx)