0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00

build: fix configure script for double-digits

Compare versions using tuples instead of strings so that it is
future-proofed against versions that contain a number that is more than
one digit.

PR-URL: https://github.com/nodejs/node/pull/21183
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
Misty De Meo 2018-06-06 12:28:42 -07:00 committed by Rich Trott
parent 00e479fed4
commit 641d4a4159

8
configure vendored
View File

@ -612,8 +612,8 @@ def try_check_compiler(cc, lang):
values = (proc.communicate()[0].split() + ['0'] * 7)[0:7]
is_clang = values[0] == '1'
gcc_version = '%s.%s.%s' % tuple(values[1:1+3])
clang_version = '%s.%s.%s' % tuple(values[4:4+3])
gcc_version = tuple(values[1:1+3])
clang_version = tuple(values[4:4+3])
return (True, is_clang, clang_version, gcc_version)
@ -710,13 +710,13 @@ def check_compiler(o):
ok, is_clang, clang_version, gcc_version = try_check_compiler(CXX, 'c++')
if not ok:
warn('failed to autodetect C++ compiler version (CXX=%s)' % CXX)
elif clang_version < '3.4.2' if is_clang else gcc_version < '4.9.4':
elif clang_version < (3, 4, 2) if is_clang else gcc_version < (4, 9, 4):
warn('C++ compiler too old, need g++ 4.9.4 or clang++ 3.4.2 (CXX=%s)' % CXX)
ok, is_clang, clang_version, gcc_version = try_check_compiler(CC, 'c')
if not ok:
warn('failed to autodetect C compiler version (CC=%s)' % CC)
elif not is_clang and gcc_version < '4.2.0':
elif not is_clang and gcc_version < (4, 2, 0):
# clang 3.2 is a little white lie because any clang version will probably
# do for the C bits. However, we might as well encourage people to upgrade
# to a version that is not completely ancient.