summaryrefslogtreecommitdiff
path: root/platform/x11/detect.py
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-11-09 16:12:16 +0100
committerGitHub <noreply@github.com>2018-11-09 16:12:16 +0100
commit06c42d151cf7b70b73dda42eba78e91b05c12814 (patch)
tree886a9047359f700880a3ad105c5a2606ad4832b3 /platform/x11/detect.py
parentd4c62e714c8901277cb29d53430ae415bf4d03c7 (diff)
parent34e2d2f4f7224ac24dec5f0461d80cb9dfddb827 (diff)
Merge pull request #23542 from marcelofg55/no_pie
Fix binaries incorrectly detected as shared libraries on some linux distros
Diffstat (limited to 'platform/x11/detect.py')
-rw-r--r--platform/x11/detect.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index ee59e9b5a1..dc5c22b4b3 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -149,6 +149,18 @@ def configure(env):
env.Append(CCFLAGS=['-pipe'])
env.Append(LINKFLAGS=['-pipe'])
+ # Check for gcc version > 4 before adding -no-pie
+ import re
+ import subprocess
+ proc = subprocess.Popen([env['CXX'], '--version'], stdout=subprocess.PIPE)
+ (stdout, _) = proc.communicate()
+ match = re.search('[0-9][0-9.]*', stdout)
+ if match is not None:
+ version = match.group().split('.')
+ if (version[0] > '4'):
+ env.Append(CCFLAGS=['-fpie'])
+ env.Append(LINKFLAGS=['-no-pie'])
+
## Dependencies
env.ParseConfig('pkg-config x11 --cflags --libs')