From a2475509e57813ea6dccea659fe2daa82e8f1372 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 25 Nov 2014 02:20:21 -0500 Subject: [PATCH] Check for clang with an actual code check. Turns out Apple in its infinite wisdom installs clang as /usr/bin/g++, so guessing based on executable name doesn't work. --- wscript | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 275dfdfecc..7e7e65489d 100644 --- a/wscript +++ b/wscript @@ -148,8 +148,16 @@ def set_compiler_flags (conf,opt): version = u[2] # waf adds -O0 -g itself. thanks waf! - is_clang = 'clang++' in conf.env['CXX'][0] - + is_clang = conf.check_cxx(fragment = ''' +#ifndef __clang__ +#error +#endif +int main() { return 0; }''', + features = 'cxx', + mandatory = False, + execute = False, + msg = 'Checking for clang') + if conf.options.asan: conf.check_cxx(cxxflags=["-fsanitize=address", "-fno-omit-frame-pointer"], linkflags=["-fsanitize=address"]) cxx_flags.append('-fsanitize=address')