Skip to content

Commit

Permalink
detect_c_compiler(): support extra commands and arguments in the string
Browse files Browse the repository at this point in the history
- Hanlde correctly a multi command string in evironment variable, e.g.:
  CC="ccache gcc" meson
- Handle correctly a list for the cross-file option, e.g:
  [binaries]
  c = ['ccache', '/usr/local/bin/mips-linuc-gcc']

This commit fixes mesonbuild#1392.
  • Loading branch information
fabio-porcedda committed Feb 17, 2017
1 parent 26e61ee commit 44db495
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions mesonbuild/environment.py
Expand Up @@ -349,7 +349,9 @@ def get_gnu_compiler_type(defines):
def detect_c_compiler(self, want_cross):
evar = 'CC'
if self.is_cross_build() and want_cross:
compilers = [self.cross_info.config['binaries']['c']]
compilers = self.cross_info.config['binaries']['c']
if not isinstance(compilers, list):
compilers = [compilers]
ccache = []
is_cross = True
if self.cross_info.need_exe_wrapper():
Expand Down Expand Up @@ -386,22 +388,22 @@ def detect_c_compiler(self, want_cross):
continue
gtype = self.get_gnu_compiler_type(defines)
version = self.get_gnu_version_from_defines(defines)
return GnuCCompiler(ccache + [compiler], version, gtype, is_cross, exe_wrap, defines)
return GnuCCompiler(ccache + compilers, version, gtype, is_cross, exe_wrap, defines)
if 'clang' in out:
if 'Apple' in out or for_darwin(want_cross, self):
cltype = CLANG_OSX
else:
cltype = CLANG_STANDARD
return ClangCCompiler(ccache + [compiler], version, cltype, is_cross, exe_wrap)
return ClangCCompiler(ccache + compilers, version, cltype, is_cross, exe_wrap)
if 'Microsoft' in out or 'Microsoft' in err:
# Visual Studio prints version number to stderr but
# everything else to stdout. Why? Lord only knows.
version = search_version(err)
return VisualStudioCCompiler([compiler], version, is_cross, exe_wrap)
return VisualStudioCCompiler(compilers, version, is_cross, exe_wrap)
if '(ICC)' in out:
# TODO: add microsoft add check OSX
inteltype = ICC_STANDARD
return IntelCCompiler(ccache + [compiler], version, inteltype, is_cross, exe_wrap)
return IntelCCompiler(ccache + compilers, version, inteltype, is_cross, exe_wrap)
errmsg = 'Unknown compiler(s): "' + ', '.join(compilers) + '"'
if popen_exceptions:
errmsg += '\nThe follow exceptions were encountered:'
Expand Down

0 comments on commit 44db495

Please sign in to comment.