build: Detecting if UNIX socket is available and disabling it if it is not
Change-Id: Iacdffe36223c085136a4fe09587ce304a3029853
diff --git a/.waf-tools/unix-socket.py b/.waf-tools/unix-socket.py
new file mode 100644
index 0000000..916fb42
--- /dev/null
+++ b/.waf-tools/unix-socket.py
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+# encoding: utf-8
+
+BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
+#include <iostream>
+#include <boost/asio.hpp>
+int main() {
+#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
+ std::cout << "yes";
+#else
+ std::cout << "no";
+#endif
+ return 0;
+}
+'''
+
+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":
+ conf.define('HAVE_UNIX_SOCKETS', 1)
+ conf.env['HAVE_UNIX_SOCKETS'] = True