summaryrefslogtreecommitdiff
path: root/platform/x11/detect.py
diff options
context:
space:
mode:
Diffstat (limited to 'platform/x11/detect.py')
-rw-r--r--platform/x11/detect.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index ee59e9b5a1..524c8448bc 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -1,6 +1,7 @@
import os
import platform
import sys
+from compat import decode_utf8
def is_active():
@@ -149,6 +150,19 @@ def configure(env):
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
+ # Check for gcc version > 5 before adding -no-pie
+ import re
+ import subprocess
+ proc = subprocess.Popen([env['CXX'], '--version'], stdout=subprocess.PIPE)
+ (stdout, _) = proc.communicate()
+ stdout = decode_utf8(stdout)
+ match = re.search('[0-9][0-9.]*', stdout)
+ if match is not None:
+ version = match.group().split('.')
+ if (version[0] > '5'):
+ env.Append(CCFLAGS=['-fpie'])
+ env.Append(LINKFLAGS=['-no-pie'])
+
## Dependencies
env.ParseConfig('pkg-config x11 --cflags --libs')