waf: Add address sanitizer configure option.
[nivanova/samba-autobuild/.git] / buildtools / wafsamba / samba_autoconf.py
index 8d84a5e406995e264562fb90da4c02e72e27918d..c13bfe7652791580aaa4051f9985ee8d77ba545f 100644 (file)
@@ -703,6 +703,11 @@ int main(void) {
     if Options.options.pedantic:
         conf.ADD_CFLAGS('-W', testflags=True)
 
+    if Options.options.address_sanitizer:
+        conf.ADD_CFLAGS('-fno-omit-frame-pointer -O1 -fsanitize=address', testflags=True)
+        conf.ADD_LDFLAGS('-fsanitize=address', testflags=True)
+        conf.env['ADDRESS_SANITIZER'] = True
+
 
     # Let people pass an additional ADDITIONAL_{CFLAGS,LDFLAGS}
     # environment variables which are only used the for final build.