diff options
Diffstat (limited to 'platform/x11/detect.py')
-rw-r--r-- | platform/x11/detect.py | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py index ee59e9b5a1..9b6fb2f478 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(): @@ -47,6 +48,11 @@ def can_build(): print("xrender not found.. x11 disabled.") return False + x11_error = os.system("pkg-config xi --modversion > /dev/null ") + if (x11_error): + print("xi not found.. Aborting.") + return False + return True def get_opts(): @@ -149,6 +155,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') @@ -156,13 +175,9 @@ def configure(env): env.ParseConfig('pkg-config xinerama --cflags --libs') env.ParseConfig('pkg-config xrandr --cflags --libs') env.ParseConfig('pkg-config xrender --cflags --libs') + env.ParseConfig('pkg-config xi --cflags --libs') if (env['touch']): - x11_error = os.system("pkg-config xi --modversion > /dev/null ") - if (x11_error): - print("xi not found.. cannot build with touch. Aborting.") - sys.exit(255) - env.ParseConfig('pkg-config xi --cflags --libs') env.Append(CPPFLAGS=['-DTOUCH_ENABLED']) # FIXME: Check for existence of the libs before parsing their flags with pkg-config |