blob: 07d1e9eba64f8754b8b6ee5b81f674c0046bfef9 [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 Pesavento0064c1d2018-03-03 18:43:53 -05003# Copyright (c) 2014-2018, 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 = '''
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080010#include <boost/asio.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
28 if conf.options.force_unix_socket or boost_asio_has_local_sockets():
Alexander Afanasyevc78b1412014-02-19 14:08:26 -080029 conf.define('HAVE_UNIX_SOCKETS', 1)
Davide Pesavento0064c1d2018-03-03 18:43:53 -050030 conf.env.HAVE_UNIX_SOCKETS = True