Skip to content

Commit 8d4d396

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 a7f36dd commit 8d4d396

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
@@ -654,8 +654,8 @@ def try_check_compiler(cc, lang):
654654

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

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

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

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

0 commit comments

Comments
 (0)