From a9aa5552b7d1d7696e13ac71f61b1aadba936a7d Mon Sep 17 00:00:00 2001 From: Kp Date: Fri, 15 Jul 2016 03:43:03 +0000 Subject: [PATCH] Pass SConf test macros into later tests Some tests may benefit from the results of earlier tests. Other tests may give different results if the macros from earlier tests are defined. SCons dependency checking rejects including dxxsconf.h during testing, so save the results of self._check_macro and insert them into later tests. Some tests define their macros in other ways. The macros from those tests and are not yet inserted. --- SConstruct | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/SConstruct b/SConstruct index 153a79424..d41265c78 100644 --- a/SConstruct +++ b/SConstruct @@ -329,6 +329,7 @@ struct %(N)s_derived : %(N)s_base { self.successful_flags = defaultdict(list) self._sconf_results = [] self.__tool_versions = [] + self.__defined_macros = '' def _quote_macro_value(v): return v.strip().replace('\n', ' \\\n') def _check_sconf_forced(self,calling_function): @@ -372,7 +373,10 @@ struct %(N)s_derived : %(N)s_base { #define {macro_name} {macro_value} {test} """.format(macro_name=macro_name, macro_value=macro_value, test=test), **kwargs) - context.sconf.Define(macro_name, macro_value if r else _comment_not_supported) + if not r: + macro_value = _comment_not_supported + context.sconf.Define(macro_name, macro_value) + self.__defined_macros += '#define %s %s\n' % (macro_name, macro_value) implicit_tests.append(_implicit_test.RecordedTest('check_ccache_distcc_ld_works', "assume ccache, distcc, C++ compiler, and C++ linker work")) implicit_tests.append(_implicit_test.RecordedTest('check_ccache_ld_works', "assume ccache, C++ compiler, and C++ linker work")) implicit_tests.append(_implicit_test.RecordedTest('check_distcc_ld_works', "assume distcc, C++ compiler, and C++ linker work")) @@ -617,13 +621,14 @@ help:assume C++ compiler works r = action(''' %s %s +%s #undef main /* avoid -Dmain=SDL_main from libSDL */ int main(int argc,char**argv){(void)argc;(void)argv; %s ;} -''' % (self.__tool_versions, text, main), ext) +''' % (self.__tool_versions, self.__defined_macros, text, main), ext) # Some tests check that the compiler rejects an input. # SConf considers the result a failure when the compiler # rejects the input. For tests that consider a rejection to