equal
deleted
inserted
replaced
161 |
161 |
162 # options provided in a script in a subdirectory named "src" |
162 # options provided in a script in a subdirectory named "src" |
163 opt.sub_options('src') |
163 opt.sub_options('src') |
164 |
164 |
165 |
165 |
|
166 def check_compilation_flag(conf, flag): |
|
167 """ |
|
168 Checks if the C++ compiler accepts a certain compilation flag or flags |
|
169 flag: can be a string or a list of strings |
|
170 """ |
|
171 |
|
172 # Check for -Wno-error=deprecated-declarations |
|
173 save_CXXFLAGS = list(conf.env['CXXFLAGS']) |
|
174 conf.env.append_value('CXXFLAGS', flag) |
|
175 e = conf.create_test_configurator() |
|
176 e.mandatory = 0 |
|
177 e.code = '#include <stdio.h>\nint main() { return 0; }\n' |
|
178 e.want_message = 0 |
|
179 ok = e.run() |
|
180 conf.check_message_custom(flag, 'compilation flag support', |
|
181 (ok and 'yes' or 'no')) |
|
182 |
|
183 if not ok: # if it doesn't accept, remove it again |
|
184 conf.env['CXXFLAGS'] = save_CXXFLAGS |
|
185 |
|
186 |
166 def configure(conf): |
187 def configure(conf): |
167 conf.check_tool('compiler_cxx') |
188 conf.check_tool('compiler_cxx') |
168 |
189 |
169 # create the second environment, set the variant and set its name |
190 # create the second environment, set the variant and set its name |
170 variant_env = conf.env.copy() |
191 variant_env = conf.env.copy() |
192 |
213 |
193 variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') |
214 variant_env.append_value('CXXDEFINES', 'RUN_SELF_TESTS') |
194 |
215 |
195 if (os.path.basename(conf.env['CXX']).startswith("g++") |
216 if (os.path.basename(conf.env['CXX']).startswith("g++") |
196 and 'CXXFLAGS' not in os.environ): |
217 and 'CXXFLAGS' not in os.environ): |
197 variant_env.append_value('CXXFLAGS', ['-Werror', '-Wno-error=deprecated-declarations']) |
218 |
198 |
219 variant_env.append_value('CXXFLAGS', '-Werror') |
|
220 |
|
221 check_compilation_flag(conf, '-Wno-error=deprecated-declarations') |
|
222 |
|
223 |
199 if 'debug' in Params.g_options.debug_level.lower(): |
224 if 'debug' in Params.g_options.debug_level.lower(): |
200 variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') |
225 variant_env.append_value('CXXDEFINES', 'NS3_ASSERT_ENABLE') |
201 variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') |
226 variant_env.append_value('CXXDEFINES', 'NS3_LOG_ENABLE') |
202 |
227 |
203 ## In optimized builds we still want debugging symbols, e.g. for |
228 ## In optimized builds we still want debugging symbols, e.g. for |