blob: 4c98f1a2dd7c3cc363edefa91b0d04257622235c [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#
Davide Pesavento6ecc3f82019-02-17 22:23:08 -05003# Copyright (c) 2014-2019, Regents of the University of California
Alexander Afanasyev97e4cac2014-03-28 10:55:11 -07004#
5# GPL 3.0 license, see the COPYING.md file for more information
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08006
Alexander Afanasyev885a85b2014-04-12 21:01:13 -07007from waflib import Options
8
Alexander Afanasyevc78b1412014-02-19 14:08:26 -08009BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK = '''
Davide Pesavento6ecc3f82019-02-17 22:23:08 -050010#include <boost/asio/local/basic_endpoint.hpp>
Davide Pesaventoa4e71b42014-05-05 19:57:12 +020011#ifndef BOOST_ASIO_HAS_LOCAL_SOCKETS
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080012#error "Unix sockets are not available on this platform"
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080013#endif
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080014'''
15
Alexander Afanasyev885a85b2014-04-12 21:01:13 -070016def addUnixOptions(self, opt):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080017 opt.add_option('--force-unix-socket', action='store_true', default=False,
Davide Pesavento0064c1d2018-03-03 18:43:53 -050018 help='Forcefully enable Unix sockets support')
19
20setattr(Options.OptionsContext, 'addUnixOptions', addUnixOptions)
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080021
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080022def configure(conf):
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080023 def boost_asio_has_local_sockets():
Davide Pesaventoa4e71b42014-05-05 19:57:12 +020024 return conf.check_cxx(msg='Checking if Unix sockets are supported',
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080025 fragment=BOOST_ASIO_HAS_LOCAL_SOCKETS_CHECK,
Davide Pesaventoa4e71b42014-05-05 19:57:12 +020026 features='cxx', use='BOOST', mandatory=False)
Alexander Afanasyevd0b44912014-02-27 14:44:59 -080027
Davide Pesavento6ecc3f82019-02-17 22:23:08 -050028 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)