diff --git a/modules/gmake/tests/cpp/test_tools.lua b/modules/gmake/tests/cpp/test_tools.lua index 6b5a083191..69e376674a 100644 --- a/modules/gmake/tests/cpp/test_tools.lua +++ b/modules/gmake/tests/cpp/test_tools.lua @@ -30,6 +30,15 @@ function suite.usesCorrectTools() make.cppTools(cfg, p.tools.gcc) test.capture [[ + ifeq ($(origin CC), default) + CC = gcc + endif + ifeq ($(origin CXX), default) + CXX = g++ + endif + ifeq ($(origin AR), default) + AR = ar + endif RESCOMP = windres ]] end diff --git a/modules/gmake2/tests/test_gmake2_tools.lua b/modules/gmake2/tests/test_gmake2_tools.lua index 9474176d32..01460a69a7 100644 --- a/modules/gmake2/tests/test_gmake2_tools.lua +++ b/modules/gmake2/tests/test_gmake2_tools.lua @@ -31,6 +31,15 @@ function suite.usesCorrectTools() gmake2.cpp.tools(cfg, p.tools.gcc) test.capture [[ +ifeq ($(origin CC), default) + CC = gcc +endif +ifeq ($(origin CXX), default) + CXX = g++ +endif +ifeq ($(origin AR), default) + AR = ar +endif RESCOMP = windres ]] end diff --git a/src/tools/gcc.lua b/src/tools/gcc.lua index e4aa12c2bb..9bac20ef2b 100644 --- a/src/tools/gcc.lua +++ b/src/tools/gcc.lua @@ -684,5 +684,5 @@ if ((cfg.gccprefix or version ~= "") and gcc.tools[tool]) or tool == "rc" then return (cfg.gccprefix or "") .. gcc.tools[tool] .. version end - return nil + return gcc.tools[tool] end diff --git a/tests/tools/test_gcc.lua b/tests/tools/test_gcc.lua index fcc085511d..0a875b6277 100644 --- a/tests/tools/test_gcc.lua +++ b/tests/tools/test_gcc.lua @@ -33,9 +33,18 @@ function suite.tools_onDefaults() prepare() - test.isnil(gcc.gettoolname(cfg, "cc")) - test.isnil(gcc.gettoolname(cfg, "cxx")) - test.isnil(gcc.gettoolname(cfg, "ar")) + test.isequal("gcc", gcc.gettoolname(cfg, "cc")) + test.isequal("g++", gcc.gettoolname(cfg, "cxx")) + test.isequal("ar", gcc.gettoolname(cfg, "ar")) + test.isequal("windres", gcc.gettoolname(cfg, "rc")) + end + + function suite.tools_withGcc() + toolset "gcc" + prepare() + test.isequal("gcc", gcc.gettoolname(cfg, "cc")) + test.isequal("g++", gcc.gettoolname(cfg, "cxx")) + test.isequal("ar", gcc.gettoolname(cfg, "ar")) test.isequal("windres", gcc.gettoolname(cfg, "rc")) end