Skip to content

Commit 1792470

Browse files
Stefan Budeanubnoordhuis
Stefan Budeanu
authored andcommitted
build: correctly detect clang version
Use the "Apple LLVM" version number since the banner has changed in newer versions of Mac OS X, resulting in the obsolete assembler path being used to compile OpenSSL. PR-URL: #5553 Reviewed-By: Ben Noordhuis <[email protected]>
1 parent e38e2a6 commit 1792470

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

configure

+11-3
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def try_check_compiler(cc, lang):
441441
# Commands and regular expressions to obtain its version number are taken from
442442
# https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129
443443
#
444-
def get_llvm_version(cc):
444+
def get_version_helper(cc, regexp):
445445
try:
446446
proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE,
447447
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
@@ -454,14 +454,20 @@ def get_llvm_version(cc):
454454
'''
455455
sys.exit()
456456

457-
match = re.search(r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)",
458-
proc.communicate()[1])
457+
match = re.search(regexp, proc.communicate()[1])
459458

460459
if match:
461460
return match.group(2)
462461
else:
463462
return 0
464463

464+
def get_llvm_version(cc):
465+
return get_version_helper(
466+
cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)")
467+
468+
def get_xcode_version(cc):
469+
return get_version_helper(
470+
cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)")
465471

466472
def get_gas_version(cc):
467473
try:
@@ -516,6 +522,8 @@ def check_compiler(o):
516522

517523
if is_clang:
518524
o['variables']['llvm_version'] = get_llvm_version(CC)
525+
if sys.platform == 'darwin':
526+
o['variables']['xcode_version'] = get_xcode_version(CC)
519527
else:
520528
o['variables']['gas_version'] = get_gas_version(CC)
521529

deps/openssl/openssl.gyp

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
'gcc_version': 0,
99
'openssl_no_asm%': 0,
1010
'llvm_version%': 0,
11+
'xcode_version%': 0,
1112
'gas_version%': 0,
1213
'openssl_fips%': 'false',
1314
},

deps/openssl/openssl.gypi

+1-1
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@
10401040
#
10411041
'conditions': [
10421042
['(OS=="win" and MSVS_VERSION>="2012") or '
1043-
'llvm_version>="3.3" or gas_version>="2.23"', {
1043+
'llvm_version>="3.3" or xcode_version>="5.0" or gas_version>="2.23"', {
10441044
'openssl_sources_x64_win_masm': [
10451045
'<@(openssl_sources_asm_latest_x64_win_masm)',
10461046
'<@(openssl_sources_common_x64_win_masm)',

0 commit comments

Comments
 (0)