Alexander Afanasyev | 97e4cac | 2014-03-28 10:55:11 -0700 | [diff] [blame] | 1 | # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*- |
| 2 | # |
Davide Pesavento | 6ecc3f8 | 2019-02-17 22:23:08 -0500 | [diff] [blame] | 3 | # Copyright (c) 2014-2019, Regents of the University of California |
Alexander Afanasyev | 97e4cac | 2014-03-28 10:55:11 -0700 | [diff] [blame] | 4 | # |
| 5 | # GPL 3.0 license, see the COPYING.md file for more information |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 6 | |
Alexander Afanasyev | 885a85b | 2014-04-12 21:01:13 -0700 | [diff] [blame] | 7 | from waflib import Options |
| 8 | |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 9 | BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = ''' |
Davide Pesavento | 6ecc3f8 | 2019-02-17 22:23:08 -0500 | [diff] [blame] | 10 | #include <boost/asio/local/basic_endpoint.hpp> |
Davide Pesavento | a4e71b4 | 2014-05-05 19:57:12 +0200 | [diff] [blame] | 11 | #ifndef BOOST_ASIO_HAS_LOCAL_SOCKETS |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 12 | #error "Unix sockets are not available on this platform" |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 13 | #endif |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 14 | ''' |
| 15 | |
Alexander Afanasyev | 885a85b | 2014-04-12 21:01:13 -0700 | [diff] [blame] | 16 | def addUnixOptions(self, opt): |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 17 | opt.add_option('--force-unix-socket', action='store_true', default=False, |
Davide Pesavento | 0064c1d | 2018-03-03 18:43:53 -0500 | [diff] [blame] | 18 | help='Forcefully enable Unix sockets support') |
| 19 | |
| 20 | setattr(Options.OptionsContext, 'addUnixOptions', addUnixOptions) |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 21 | |
Alexander Afanasyev | c78b141 | 2014-02-19 14:08:26 -0800 | [diff] [blame] | 22 | def configure(conf): |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 23 | def boost_asio_has_local_sockets(): |
Davide Pesavento | a4e71b4 | 2014-05-05 19:57:12 +0200 | [diff] [blame] | 24 | return conf.check_cxx(msg='Checking if Unix sockets are supported', |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 25 | fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK, |
Davide Pesavento | a4e71b4 | 2014-05-05 19:57:12 +0200 | [diff] [blame] | 26 | features='cxx', use='BOOST', mandatory=False) |
Alexander Afanasyev | d0b4491 | 2014-02-27 14:44:59 -0800 | [diff] [blame] | 27 | |
Davide Pesavento | 6ecc3f8 | 2019-02-17 22:23:08 -0500 | [diff] [blame] | 28 | conf.env.HAVE_UNIX_SOCKETS = conf.options.force_unix_socket or boost_asio_has_local_sockets() |
| 29 | conf.define_cond('HAVE_UNIX_SOCKETS', conf.env.HAVE_UNIX_SOCKETS) |