Skip to content

Commit e987929

Browse files
Stefan BudeanuMyles Borins
Stefan Budeanu
authored and
Myles Borins
committed
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 1f5f341 commit e987929

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

configure

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def try_check_compiler(cc, lang):
433433
# Commands and regular expressions to obtain its version number are taken from
434434
# https://github.com/openssl/openssl/blob/OpenSSL_1_0_2-stable/crypto/sha/asm/sha512-x86_64.pl#L112-L129
435435
#
436-
def get_llvm_version(cc):
436+
def get_version_helper(cc, regexp):
437437
try:
438438
proc = subprocess.Popen(shlex.split(cc) + ['-v'], stdin=subprocess.PIPE,
439439
stderr=subprocess.PIPE, stdout=subprocess.PIPE)
@@ -446,14 +446,20 @@ def get_llvm_version(cc):
446446
'''
447447
sys.exit()
448448

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

452451
if match:
453452
return match.group(2)
454453
else:
455454
return 0
456455

456+
def get_llvm_version(cc):
457+
return get_version_helper(
458+
cc, r"(^clang version|based on LLVM) ([3-9]\.[0-9]+)")
459+
460+
def get_xcode_version(cc):
461+
return get_version_helper(
462+
cc, r"(^Apple LLVM version) ([5-9]\.[0-9]+)")
457463

458464
def get_gas_version(cc):
459465
try:
@@ -508,6 +514,8 @@ def check_compiler(o):
508514

509515
if is_clang:
510516
o['variables']['llvm_version'] = get_llvm_version(CC)
517+
if sys.platform == 'darwin':
518+
o['variables']['xcode_version'] = get_xcode_version(CC)
511519
else:
512520
o['variables']['gas_version'] = get_gas_version(CC)
513521

deps/openssl/openssl.gyp

Lines changed: 1 addition & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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)