blob: f5f61b474bdca8a32784f6f421b6782e1358e6e4 [file] [log] [blame]
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08001#!/usr/bin/env python
2# encoding: utf-8
3
4BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
5#include <iostream>
6#include <boost/asio.hpp>
7int main() {
8#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
Alexander Afanasyevd0b44912014-02-27 14:44:59 -08009 return 0;
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080010#else
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080011#error "Unix sockets are not available on this platform"
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080012#endif
13 return 0;
14}
15'''
16
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080017def 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 Afanasyevc78b1412014-02-19 14:08:26 -080021def configure(conf):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080022 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 Afanasyevc78b1412014-02-19 14:08:26 -080028 conf.define('HAVE_UNIX_SOCKETS', 1)
29 conf.env['HAVE_UNIX_SOCKETS'] = True