blob: f697f0cb7c48da4f1217f712a198e4e35b1ab7a7 [file] [log] [blame]
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2#
3# Copyright (c) 2014, Regents of the University of California
4#
5# GPL 3.0 license, see the COPYING.md file for more information
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08006
7BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
8#include <iostream>
9#include <boost/asio.hpp>
10int main() {
11#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080012 return 0;
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080013#else
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080014#error "Unix sockets are not available on this platform"
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080015#endif
16 return 0;
17}
18'''
19
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080020def options(opt):
21 opt.add_option('--force-unix-socket', action='store_true', default=False,
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -070022 dest='force_unix_socket', help='''Forcefully enable UNIX sockets support''')
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080023
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080024def configure(conf):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080025 def boost_asio_has_local_sockets():
26 return conf.check_cxx(msg='Checking if UNIX sockets are supported',
27 fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK,
28 use='BOOST NDN_CPP RT', mandatory=False)
29
30 if conf.options.force_unix_socket or boost_asio_has_local_sockets():
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080031 conf.define('HAVE_UNIX_SOCKETS', 1)
32 conf.env['HAVE_UNIX_SOCKETS'] = True