build: detect override & final specifiers support

refs #2454

Change-Id: I274fec7c5b6348e8b688eda2f2e13d04984d61e4
diff --git a/.waf-tools/compiler-features.py b/.waf-tools/compiler-features.py
index 4bc9594..2500298 100644
--- a/.waf-tools/compiler-features.py
+++ b/.waf-tools/compiler-features.py
@@ -43,5 +43,33 @@
                       features='cxx', mandatory=True):
         self.define('HAVE_CXX_FRIEND_TYPENAME_WRAPPER', 1)
 
+OVERRIDE = '''
+class Base
+{
+  virtual void
+  f(int a);
+};
+
+class Derived : public Base
+{
+  virtual void
+  f(int a) override;
+};
+
+class Final : public Derived
+{
+  virtual void
+  f(int a) final;
+};
+'''
+
+@conf
+def check_override(self):
+    if self.check_cxx(msg='Checking for override and final specifiers',
+                      fragment=OVERRIDE,
+                      features='cxx', mandatory=False):
+        self.define('HAVE_CXX_OVERRIDE_FINAL', 1)
+
 def configure(conf):
     conf.check_friend_typename()
+    conf.check_override()