summaryrefslogtreecommitdiff
path: root/wscript
diff options
context:
space:
mode:
authorSakari Bergen <sakari.bergen@beatwaves.net>2014-01-06 17:03:46 +0200
committerSakari Bergen <sakari.bergen@beatwaves.net>2014-01-06 17:04:07 +0200
commitbfe0cf9870693209d2c42913e381cd7088d6e6a4 (patch)
tree90dd09c1be29994192cfb4e1ce69b288aeec2eee /wscript
parent00fbc9c3427e61d231c9fc87a7801c1bdf7e2372 (diff)
Add config option for address sanitizer
Diffstat (limited to 'wscript')
-rw-r--r--wscript7
1 files changed, 7 insertions, 0 deletions
diff --git a/wscript b/wscript
index e68780f1e0..d657ea2cad 100644
--- a/wscript
+++ b/wscript
@@ -162,6 +162,11 @@ def set_compiler_flags (conf,opt):
# Prevents visibility issues in standard headers
conf.define("_DARWIN_C_SOURCE", 1)
+ if conf.options.asan:
+ conf.check_cxx(cxxflags=["-fsanitize=address"], linkflags=["-fsanitize=address"])
+ cxx_flags.append('-fsanitize=address')
+ linker_flags.append('-fsanitize=address')
+
if is_clang and platform == "darwin":
# Silence warnings about the non-existing osx clang compiler flags
# -compatibility_version and -current_version. These are Waf
@@ -502,6 +507,8 @@ def options(opt):
help='Do not ask questions that require confirmation during the build')
opt.add_option('--cxx11', action='store_true', default=False, dest='cxx11',
help='Turn on c++11 compiler flags (-std=c++11)')
+ opt.add_option('--address-sanitizer', action='store_true', default=False, dest='asan',
+ help='Turn on AddressSanitizer (requires GCC >= 4.8 or clang)')
for i in children:
opt.recurse(i)