blob: 391fffbcb7871edd137c0931a0e755acc0ffe135 [file] [log] [blame]
Davide Pesavento6ecc3f82019-02-17 22:23:08 -05001# Copyright (c) 2014-2019, Regents of the University of California
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -07002#
3# GPL 3.0 license, see the COPYING.md file for more information
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08004
Alexander Afanasyev885a85b2014-04-12 21:01:13 -07005from waflib import Options
6
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08007BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
Davide Pesavento6ecc3f82019-02-17 22:23:08 -05008#include <boost/asio/local/basic_endpoint.hpp>
Davide Pesaventoa4e71b42014-05-05 19:57:12 +02009#ifndef BOOST_ASIO_HAS_LOCAL_SOCKETS
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080010#error "Unix sockets are not available on this platform"
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080011#endif
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080012'''
13
Alexander Afanasyev885a85b2014-04-12 21:01:13 -070014def addUnixOptions(self, opt):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080015 opt.add_option('--force-unix-socket', action='store_true', default=False,
Davide Pesavento0064c1d2018-03-03 18:43:53 -050016 help='Forcefully enable Unix sockets support')
17
18setattr(Options.OptionsContext, 'addUnixOptions', addUnixOptions)
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080019
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080020def configure(conf):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080021 def boost_asio_has_local_sockets():
Davide Pesaventoa4e71b42014-05-05 19:57:12 +020022 return conf.check_cxx(msg='Checking if Unix sockets are supported',
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080023 fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK,
Davide Pesaventoa4e71b42014-05-05 19:57:12 +020024 features='cxx', use='BOOST', mandatory=False)
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080025
Davide Pesavento6ecc3f82019-02-17 22:23:08 -050026 conf.env.HAVE_UNIX_SOCKETS = conf.options.force_unix_socket or boost_asio_has_local_sockets()
27 conf.define_cond('HAVE_UNIX_SOCKETS', conf.env.HAVE_UNIX_SOCKETS)