build: Add -isystem and set specialized flags as a last configuration step

This change prevents global flags from interacting with library/feature
detection scripts.

Change-Id: Ib7b1d230f77668cad31cffdd18962cba41c856e9
Refs: #4296
diff --git a/wscript b/wscript
index 00d472f..abdf4ef 100644
--- a/wscript
+++ b/wscript
@@ -34,11 +34,13 @@
         boost_libs += ' unit_test_framework'
     conf.check_boost(lib=boost_libs)
 
+    conf.recurse('tools')
+
+    conf.check_compiler_flags()
+
     # Loading "late" to prevent tests from being compiled with profiling flags
     conf.load('coverage')
 
-    conf.recurse('tools')
-
     conf.load('sanitizers')
 
 def build(bld):