summaryrefslogtreecommitdiffstats
path: root/security/nss/coreconf/check_cc.py
blob: 6d7e38096176d87d13a5ec7dcda36cd73d8e8763 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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()