diff options
author | Sadique Ali <sadiqalikm@gmail.com> | 2012-05-01 14:33:36 +0400 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2012-05-16 00:51:17 +0400 |
commit | c9676c9147e088171e60b1977ac239ded4f327df (patch) | |
tree | 11b0e355721b778c231ed89a56b230cac1157776 /configure | |
parent | 9ae6d8fee345bdbc6f94e38eee57b60d231288eb (diff) |
build: improve c compiler detection
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/configure b/configure index 217d9223338..fe3b5308c26 100755 --- a/configure +++ b/configure @@ -224,18 +224,22 @@ def host_arch(): def target_arch(): return host_arch() - -def gcc_version(): +def cc_version(): try: proc = subprocess.Popen([CC, '-v'], stderr=subprocess.PIPE) except OSError: return None - # TODO parse clang output - version = proc.communicate()[1].split('\n')[-2] - match = re.match('gcc version (\d+)\.(\d+)\.(\d+)', version) - if not match: return None - return ['LLVM' in version] + map(int, match.groups()) - + lines = proc.communicate()[1].split('\n') + version_line = None + for i, line in enumerate(lines): + if 'version' in line: + version_line = line + if not version_line: + return None + version = version_line.split("version")[1].strip().split()[0].split(".") + if not version: + return None + return ['LLVM' in version_line] + version def configure_node(o): # TODO add gdb @@ -250,10 +254,10 @@ def configure_node(o): # see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45883 # see http://code.google.com/p/v8/issues/detail?id=884 o['variables']['strict_aliasing'] = b( - 'clang' in CC or gcc_version() >= [False, 4, 6, 0]) + 'clang' in CC or cc_version() >= [False, 4, 6, 0]) # clang has always supported -fvisibility=hidden, right? - if 'clang' not in CC and gcc_version() < [False, 4, 0, 0]: + if 'clang' not in CC and cc_version() < [False, 4, 0, 0]: o['variables']['visibility'] = '' # By default, enable DTrace on SunOS systems. Don't allow it on other |