build: Disable Ethernet face support on OSX with Boost 1.56

Change-Id: Ib3415d5fa1d64e76877bb0f1dcfda783cfe47ca7
Refs: #1877
diff --git a/.waf-tools/boost-kqueue.py b/.waf-tools/boost-kqueue.py
new file mode 100644
index 0000000..a2ec732
--- /dev/null
+++ b/.waf-tools/boost-kqueue.py
@@ -0,0 +1,22 @@
+# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
+#
+# Copyright (c) 2014, Regents of the University of California
+#
+# GPL 3.0 license, see the COPYING.md file for more information
+
+from waflib import Configure
+
+BOOST_ASIO_HAS_KQUEUE_CHECK = '''
+#include <boost/asio.hpp>
+#if defined(BOOST_ASIO_HAS_KQUEUE) and BOOST_VERSION >= 105600
+#error "Ethernet face support cannot be enabled on this platform"
+#endif
+'''
+
+@Configure.conf
+def check_asio_pcap_support(conf):
+    if conf.check_cxx(msg='Checking if Ethernet face support can be enabled',
+                      fragment=BOOST_ASIO_HAS_KQUEUE_CHECK,
+                      features='cxx', use='BOOST', mandatory=False):
+        conf.define('HAVE_ASIO_PCAP_SUPPORT', 1)
+        conf.env['HAVE_ASIO_PCAP_SUPPORT'] = True
diff --git a/tests/daemon/mgmt/face-manager.cpp b/tests/daemon/mgmt/face-manager.cpp
index 601724a..855c7bd 100644
--- a/tests/daemon/mgmt/face-manager.cpp
+++ b/tests/daemon/mgmt/face-manager.cpp
@@ -32,7 +32,10 @@
 #include "fw/face-table.hpp"
 #include "fw/forwarder.hpp"
 #include "face/udp-factory.hpp"
+
+#ifdef HAVE_LIBPCAP
 #include "face/ethernet-factory.hpp"
+#endif // HAVE_LIBPCAP
 
 #include "common.hpp"
 #include "tests/test-common.hpp"
@@ -804,8 +807,7 @@
   BOOST_CHECK_EQUAL(factory->getMulticastFaces().size(), 0);
 }
 
-
-#endif
+#endif // HAVE_LIBPCAP
 
 BOOST_AUTO_TEST_CASE(TestFireInterestFilter)
 {
diff --git a/wscript b/wscript
index ba1c6eb..e985314 100644
--- a/wscript
+++ b/wscript
@@ -34,7 +34,7 @@
 def options(opt):
     opt.load(['compiler_cxx', 'gnu_dirs'])
     opt.load(['boost', 'unix-socket', 'dependency-checker', 'websocket',
-              'default-compiler-flags', 'coverage', 'pch',
+              'default-compiler-flags', 'coverage', 'pch', 'boost-kqueue',
               'doxygen', 'sphinx_build'],
              tooldir=['.waf-tools'])
 
@@ -56,7 +56,7 @@
 
 def configure(conf):
     conf.load(['compiler_cxx', 'gnu_dirs',
-               'default-compiler-flags', 'pch',
+               'default-compiler-flags', 'pch', 'boost-kqueue',
                'boost', 'dependency-checker', 'websocket',
                'doxygen', 'sphinx_build'])
 
@@ -88,9 +88,14 @@
     conf.checkDependency(name='libresolv', lib='resolv', mandatory=False)
 
     if not conf.options.without_libpcap:
-        conf.checkDependency(name='libpcap', lib='pcap', mandatory=True,
-                             errmsg='not found, but required for Ethernet face support. '
-                                    'Specify --without-libpcap to disable Ethernet face support.')
+        conf.check_asio_pcap_support()
+        if conf.env['HAVE_ASIO_PCAP_SUPPORT']:
+            conf.checkDependency(name='libpcap', lib='pcap', mandatory=True,
+                                 errmsg='not found, but required for Ethernet face support. '
+                                        'Specify --without-libpcap to disable Ethernet face support.')
+        else:
+            Logs.warn('Warning: Ethernet face support is not supported on this platform with Boost libraries version 1.56. '
+                      'See http://redmine.named-data.net/issues/1877 for more details')
     if conf.env['HAVE_LIBPCAP']:
         conf.check_cxx(function_name='pcap_set_immediate_mode', header_name='pcap/pcap.h',
                        cxxflags='-Wno-error', use='LIBPCAP', mandatory=False)