diff --git a/SConstruct b/SConstruct index 3734268cae8..fd266b3fa09 100644 --- a/SConstruct +++ b/SConstruct @@ -338,7 +338,7 @@ if selected_platform in platform_list: disable_nonessential_warnings = ['-Wno-sign-compare'] shadow_local_warning = [] - if 'gcc' in os.path.basename(env["CC"]): + if methods.use_gcc(env): version = methods.get_compiler_version(env) if version != None and version[0] >= '7': shadow_local_warning = ['-Wshadow-local'] diff --git a/methods.py b/methods.py index d8e90a8da54..2d4dc4921f4 100644 --- a/methods.py +++ b/methods.py @@ -667,3 +667,6 @@ def get_compiler_version(env): return match.group().split('.') else: return None + +def use_gcc(env): + return 'gcc' in os.path.basename(env["CC"]) diff --git a/platform/x11/detect.py b/platform/x11/detect.py index 16760f94075..1355ae542d6 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -2,7 +2,7 @@ import os import platform import sys from compat import decode_utf8 -from methods import get_compiler_version +from methods import get_compiler_version, use_gcc def is_active(): return True @@ -162,10 +162,11 @@ def configure(env): env.Append(LINKFLAGS=['-pipe']) # Check for gcc version >= 6 before adding -no-pie - version = get_compiler_version(env) - if version != None and version[0] > '6': - env.Append(CCFLAGS=['-fpie']) - env.Append(LINKFLAGS=['-no-pie']) + if use_gcc(env): + version = get_compiler_version(env) + if version != None and version[0] >= '6': + env.Append(CCFLAGS=['-fpie']) + env.Append(LINKFLAGS=['-no-pie']) ## Dependencies