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: Id4d1d3f6cba6672ef04309b881bcff36a106f236
Refs: #4296
diff --git a/wscript b/wscript
index e0fee20..873b3c4 100644
--- a/wscript
+++ b/wscript
@@ -150,6 +150,8 @@
         conf.env['INCLUDES_CUSTOM_LOGGER'] = [conf.options.with_custom_logger]
         conf.env['HAVE_CUSTOM_LOGGER'] = 1
 
+    conf.check_compiler_flags()
+
     conf.load('coverage')
 
     conf.load('sanitizers')