util: Signal

Signal is an enhanced version of EventEmitter:

* only the owner can emit a signal (aka trigger an event)
* signal connection (aka event subscription) can be disconnected

EventEmitter is deprecated in favor of Signal.

refs #2279

Change-Id: I74ea5fef2e1e9b34776aa04f01170600b171152e
diff --git a/.waf-tools/compiler-features.py b/.waf-tools/compiler-features.py
new file mode 100644
index 0000000..4bc9594
--- /dev/null
+++ b/.waf-tools/compiler-features.py
@@ -0,0 +1,47 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+
+from waflib.Configure import conf
+
+FRIEND_TYPENAME = '''
+class A;
+
+template<typename T>
+class B
+{
+  friend T;
+};
+
+B<A> g_b;
+'''
+
+FRIEND_WRAPPER = '''
+class A;
+
+template<typename T>
+struct TypeWrapper
+{
+  typedef T Type;
+};
+
+template<typename T>
+class B
+{
+  friend class TypeWrapper<T>::Type;
+};
+
+B<A> g_b;
+'''
+
+@conf
+def check_friend_typename(self):
+    if self.check_cxx(msg='Checking for friend typename-specifier',
+                      fragment=FRIEND_TYPENAME,
+                      features='cxx', mandatory=False):
+        self.define('HAVE_CXX_FRIEND_TYPENAME', 1)
+    elif self.check_cxx(msg='Checking for friend typename using wrapper',
+                      fragment=FRIEND_WRAPPER,
+                      features='cxx', mandatory=True):
+        self.define('HAVE_CXX_FRIEND_TYPENAME_WRAPPER', 1)
+
+def configure(conf):
+    conf.check_friend_typename()