diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 2bff42b1d..a478c7961 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -75,7 +75,7 @@ class CCompiler(CLikeCompiler, Compiler): return ['-nostdinc'] def _sanity_check_source_code(self) -> str: - return 'int main(void) { int class=0; return class; }\n' + return '#include \nint main(void) { int class=0; return class; }\n' def has_header_symbol(self, hname: str, symbol: str, prefix: str, *, extra_args: T.Union[None, T.List[str], T.Callable[['CompileCheckMode'], T.List[str]]] = None, diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 2652a7f5e..deafa3eea 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1366,7 +1366,9 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): :return: a tuple of arguments, the first is the executable and compiler arguments, the second is linker arguments """ - return self.exelist_no_ccache + self.get_always_args() + self.get_output_args(binname) + [sourcename], [] + cargs = list(self.environment.coredata.get_external_args(self.for_machine, self.language)) + largs = list(self.environment.coredata.get_external_link_args(self.for_machine, self.language)) + return self.exelist_no_ccache + self.get_always_args() + self.get_output_args(binname) + [sourcename] + cargs, largs @abc.abstractmethod def _sanity_check_source_code(self) -> str: diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index 21614f2c9..7718f5017 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -89,7 +89,7 @@ class CPPCompiler(CLikeCompiler, Compiler): return [] def _sanity_check_source_code(self) -> str: - return 'class breakCCompiler;int main(void) { return 0; }\n' + return '#include \nclass breakCCompiler;int main(void) { return 0; }\n' def get_compiler_check_args(self, mode: CompileCheckMode) -> T.List[str]: # -fpermissive allows non-conforming code to compile which is necessary