summaryrefslogtreecommitdiff
path: root/coreconf/check_cc.py
diff options
context:
space:
mode:
Diffstat (limited to 'coreconf/check_cc.py')
-rw-r--r--coreconf/check_cc.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/coreconf/check_cc.py b/coreconf/check_cc.py
new file mode 100644
index 000000000..6d7e38096
--- /dev/null
+++ b/coreconf/check_cc.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+import os
+import subprocess
+import sys
+
+def main():
+ if sys.platform == 'win32' or len(sys.argv) < 2:
+ print(0)
+ else:
+ cc = os.environ.get('CC', 'cc')
+ try:
+ cc_is_arg = sys.argv[1] in subprocess.check_output(
+ [cc, '--version'], universal_newlines=True)
+ except OSError:
+ # We probably just don't have CC/cc.
+ cc_is_arg = False
+ print(int(cc_is_arg))
+
+if __name__ == '__main__':
+ main()
+