Skip to content

Commit cc8a805

Browse files
richardlauBethGriggs
authored andcommitted
build: fix compiler version detection
Compiler version tuples should be numeric for tuple comparisons to work. Also correct check for AIX where the minimum supported GCC is 6.3.0 PR-URL: #24879 Reviewed-By: Joyee Cheung <[email protected]> Reviewed-By: Ben Noordhuis <[email protected]>
1 parent 56b2a72 commit cc8a805

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

configure.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -655,8 +655,8 @@ def try_check_compiler(cc, lang):
655655

656656
values = (proc.communicate()[0].split() + ['0'] * 7)[0:7]
657657
is_clang = values[0] == '1'
658-
gcc_version = tuple(values[1:1+3])
659-
clang_version = tuple(values[4:4+3])
658+
gcc_version = tuple(map(int, values[1:1+3]))
659+
clang_version = tuple(map(int, values[4:4+3])) if is_clang else None
660660

661661
return (True, is_clang, clang_version, gcc_version)
662662

@@ -753,6 +753,8 @@ def check_compiler(o):
753753
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
754754
if not ok:
755755
warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX)
756+
elif sys.platform.startswith('aix') and gcc_version < (6, 3, 0):
757+
warn('C++ compiler too old, need g++ 6.3.0 (CXX=%s)' % CXX)
756758
elif clang_version < (3, 4, 2) if is_clang else gcc_version < (4, 9, 4):
757759
warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX)
758760

@@ -921,8 +923,7 @@ def gcc_version_ge(version_checked):
921923
for compiler in [(CC, 'c'), (CXX, 'c++')]:
922924
ok, is_clang, clang_version, compiler_version = \
923925
try_check_compiler(compiler[0], compiler[1])
924-
compiler_version_num = tuple(map(int, compiler_version))
925-
if is_clang or compiler_version_num < version_checked:
926+
if is_clang or compiler_version < version_checked:
926927
return False
927928
return True
928929

0 commit comments

Comments
 (0)