|
@@ -1,12 +1,20 @@
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
from os import getenv
|
|
|
+from subprocess import Popen, PIPE
|
|
|
+from re import sub
|
|
|
+
|
|
|
+def clang_has_option(option):
|
|
|
+ return [o for o in Popen(['clang', option], stderr=PIPE).stderr.readlines() if "unknown argument" in o] == [ ]
|
|
|
|
|
|
cc = getenv("CC")
|
|
|
if cc == "clang":
|
|
|
from _sysconfigdata import build_time_vars
|
|
|
- from re import sub
|
|
|
build_time_vars["CFLAGS"] = sub("-specs=[^ ]+", "", build_time_vars["CFLAGS"])
|
|
|
+ if not clang_has_option("-mcet"):
|
|
|
+ build_time_vars["CFLAGS"] = sub("-mcet", "", build_time_vars["CFLAGS"])
|
|
|
+ if not clang_has_option("-fcf-protection"):
|
|
|
+ build_time_vars["CFLAGS"] = sub("-fcf-protection", "", build_time_vars["CFLAGS"])
|
|
|
|
|
|
from distutils.core import setup, Extension
|
|
|
|