blob: 502596ca112e6b1cbdbd5fcddbd513da9086bde3 [file] [log] [blame]
Junxiao Shi8d71fdb2014-12-07 21:55:19 -07001# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
2
3from waflib.Configure import conf
4
Davide Pesavento96b96af2015-09-19 23:00:40 +02005STD_TO_STRING = '''
6#include <string>
7int
Davide Pesavento7c02b472015-10-28 20:50:17 +01008main()
Davide Pesavento96b96af2015-09-19 23:00:40 +02009{
10 std::string s = std::to_string(0);
11 s = std::to_string(0l);
12 s = std::to_string(0ll);
13 s = std::to_string(0u);
14 s = std::to_string(0ul);
15 s = std::to_string(0ull);
16 s = std::to_string(0.0f);
17 s = std::to_string(0.0);
18 s = std::to_string(0.0l);
19 s.clear();
Davide Pesavento96b96af2015-09-19 23:00:40 +020020}
21'''
22
23@conf
24def check_std_to_string(self):
25 if self.check_cxx(msg='Checking for std::to_string',
26 fragment=STD_TO_STRING,
27 features='cxx', mandatory=False):
28 self.define('HAVE_STD_TO_STRING', 1)
29
Joao Pereira7476ebf2015-07-07 14:54:39 -040030VECTOR_INSERT_ERASE_CONST_ITERATOR = '''
31#include <vector>
32int
33main()
34{
35 std::vector<int> v;
36 std::vector<int>::const_iterator it = v.cbegin();
37
38 v.insert(it, 2);
39 it = v.cend() - 1;
40 v.erase(it);
Joao Pereira7476ebf2015-07-07 14:54:39 -040041}
42'''
43
44@conf
45def check_vector_const_iterators(self):
Davide Pesavento96b96af2015-09-19 23:00:40 +020046 if self.check_cxx(msg='Checking for std::vector::insert with const_iterator',
Joao Pereira7476ebf2015-07-07 14:54:39 -040047 fragment=VECTOR_INSERT_ERASE_CONST_ITERATOR,
48 features='cxx', mandatory=False):
Davide Pesavento96b96af2015-09-19 23:00:40 +020049 self.define('HAVE_VECTOR_INSERT_ERASE_CONST_ITERATOR', 1)
Joao Pereira7476ebf2015-07-07 14:54:39 -040050
Junxiao Shi8d71fdb2014-12-07 21:55:19 -070051def configure(conf):
Davide Pesavento96b96af2015-09-19 23:00:40 +020052 conf.check_std_to_string()
Joao Pereira7476ebf2015-07-07 14:54:39 -040053 conf.check_vector_const_iterators()