diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2014-07-08 17:42:58 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2014-07-08 17:42:58 +0300 |
commit | 1d9795a4c811001414ba7e9008b7c7653f1eab82 (patch) | |
tree | 7cd19187b597dbafff86234c49393a89702af549 /environment.py | |
parent | 4a23c01992c322b8f4105c0b4c526c0493745174 (diff) | |
download | meson-1d9795a4c811001414ba7e9008b7c7653f1eab82.zip meson-1d9795a4c811001414ba7e9008b7c7653f1eab82.tar.gz meson-1d9795a4c811001414ba7e9008b7c7653f1eab82.tar.bz2 |
Sanity check for Objective C compiler.
Diffstat (limited to 'environment.py')
-rw-r--r-- | environment.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/environment.py b/environment.py index c6b9add..9d9a225 100644 --- a/environment.py +++ b/environment.py @@ -389,6 +389,21 @@ class ObjCCompiler(CCompiler): return True return False + def sanity_check(self, work_dir): + source_name = os.path.join(work_dir, 'sanitycheckobjc.m') + binary_name = os.path.join(work_dir, 'sanitycheckobjc') + ofile = open(source_name, 'w') + ofile.write('#import<stdio.h>\nint main(int argc, char **argv) { return 0; }\n') + ofile.close() + pc = subprocess.Popen(self.exelist + [source_name, '-o', binary_name]) + pc.wait() + if pc.returncode != 0: + raise EnvironmentException('ObjC compiler %s can not compile programs.' % self.name_string()) + pe = subprocess.Popen(binary_name) + pe.wait() + if pe.returncode != 0: + raise EnvironmentException('Executables created by ObjC compiler %s are not runnable.' % self.name_string()) + class ObjCPPCompiler(CPPCompiler): def __init__(self, exelist, version, is_cross, exe_wrap): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap) |