Add configure option to use address sanitizer.
authorCarl Hetherington <cth@carlh.net>
Wed, 8 Jan 2014 23:27:57 +0000 (23:27 +0000)
committerCarl Hetherington <cth@carlh.net>
Wed, 8 Jan 2014 23:27:57 +0000 (23:27 +0000)
wscript

diff --git a/wscript b/wscript
index 21e889d8ad4328d9e9f9ae612a72bc4726b49636..114e3cbade09b9b10f422a964bb3e0a55c54f36d 100644 (file)
--- a/wscript
+++ b/wscript
@@ -15,6 +15,7 @@ def options(opt):
     opt.add_option('--static', action='store_true', default=False, help='build statically, and link statically to libdcp and FFmpeg')
     opt.add_option('--magickpp-config', action='store', default='Magick++-config', help='path to Magick++-config')
     opt.add_option('--wx-config', action='store', default='wx-config', help='path to wx-config')
+    opt.add_option('--address-sanitizer', action='store_true', default=False, help='build with address sanitizer')
 
 def pkg_config_args(conf):
     if conf.env.STATIC:
@@ -43,6 +44,10 @@ def configure(conf):
     else:
         conf.env.append_value('CXXFLAGS', '-O2')
 
+    if conf.options.address_sanitizer:
+        conf.env.append_value('CXXFLAGS', ['-fsanitize=address', '-fno-omit-frame-pointer'])
+        conf.env.append_value('LINKFLAGS', ['-fsanitize=address'])
+
     # Windows-specific
     if conf.env.TARGET_WINDOWS:
         conf.env.append_value('CXXFLAGS', ['-DDCPOMATIC_WINDOWS', '-DWIN32_LEAN_AND_MEAN', '-DBOOST_USE_WINDOWS_H', '-DUNICODE', '-DBOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN'])