Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | # encoding: utf-8 |
| 3 | |
| 4 | BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = ''' |
| 5 | #include <iostream> |
| 6 | #include <boost/asio.hpp> |
| 7 | int main() { |
| 8 | #ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 9 | return 0; |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 10 | #else |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 11 | #error "Unix sockets are not available on this platform" |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 12 | #endif |
| 13 | return 0; |
| 14 | } |
| 15 | ''' |
| 16 | |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 17 | def options(opt): |
| 18 | opt.add_option('--force-unix-socket', action='store_true', default=False, |
| 19 | dest='force_unix_socket',help='''Forcefully enable UNIX sockets support''') |
| 20 | |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 21 | def configure(conf): |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 22 | def boost_asio_has_local_sockets(): |
| 23 | return conf.check_cxx(msg='Checking if UNIX sockets are supported', |
| 24 | fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK, |
| 25 | use='BOOST NDN_CPP RT', mandatory=False) |
| 26 | |
| 27 | if conf.options.force_unix_socket or boost_asio_has_local_sockets(): |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 28 | conf.define('HAVE_UNIX_SOCKETS', 1) |
| 29 | conf.env['HAVE_UNIX_SOCKETS'] = True |