blob: a8fe55dc3e9faacfbc4e7d96ec4de3d4eb194bd8 [file] [log] [blame]
Davide Pesavento1349d2d2016-08-09 06:43:57 +02001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3def options(opt):
4 opt.add_option('--with-sanitizer', action='store', default='', dest='sanitizers',
5 help='Comma-separated list of compiler sanitizers to enable [default=none]')
6
7def configure(conf):
8 for san in conf.options.sanitizers.split(','):
9 if not san:
10 continue
11
12 sanflag = '-fsanitize=%s' % san
13 conf.start_msg('Checking if compiler supports %s' % sanflag)
14
15 if conf.check_cxx(cxxflags=['-Werror', sanflag, '-fno-omit-frame-pointer'],
16 linkflags=[sanflag], mandatory=False):
17 conf.end_msg('yes')
18 conf.env.append_unique('CXXFLAGS', [sanflag, '-fno-omit-frame-pointer'])
19 conf.env.append_unique('LINKFLAGS', [sanflag])
20 else:
21 conf.end_msg('no', color='RED')
22 conf.fatal('%s sanitizer is not supported by the current compiler' % san)