build: Allow option to force compilation with unix sockets enable

This feature will be useful for cross-compilation, when it is impossible
to execute the compiled code on the host platform.

Change-Id: Ie3d7a1ce5fc5dd5e04aa1bb77efa2c4c6755e566
diff --git a/.waf-tools/unix-socket.py b/.waf-tools/unix-socket.py
index 916fb42..f5f61b4 100644
--- a/.waf-tools/unix-socket.py
+++ b/.waf-tools/unix-socket.py
@@ -6,19 +6,24 @@
 #include <boost/asio.hpp>
 int main() {
 #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
-    std::cout << "yes";
+    return 0;
 #else
-    std::cout << "no";
+#error "Unix sockets are not available on this platform"
 #endif
     return 0;
 }
 '''
 
+def options(opt):
+    opt.add_option('--force-unix-socket', action='store_true', default=False,
+                   dest='force_unix_socket',help='''Forcefully enable UNIX sockets support''')
+
 def configure(conf):
-    boost_asio_present = conf.check_cxx(msg='Checking if UNIX socket is supported',
-                                        fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK,
-                                        use='BOOST NDN_CPP RT',
-                                        execute=True, define_ret=True)
-    if boost_asio_present == "yes":
+    def boost_asio_has_local_sockets():
+        return conf.check_cxx(msg='Checking if UNIX sockets are supported',
+                              fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK,
+                              use='BOOST NDN_CPP RT', mandatory=False)
+
+    if conf.options.force_unix_socket or boost_asio_has_local_sockets():
         conf.define('HAVE_UNIX_SOCKETS', 1)
         conf.env['HAVE_UNIX_SOCKETS'] = True