In some cases, especially when using autotools, the value of CC or CXX may have spaces in it. For example, in my project CXX is detected as g++ -std=c++17. Should the -std=c++17 part really be in CXXFLAGS? Absolutely, but autotools isn't going to make that easy. Other examples are mpicc -cc=clang (MPICH) or if using an absolute path with spaces.
configure doesn't seem to handle this gracefully and just takes the first word, e.g. truncating g++ -std=c++17 to g++. The correct value (with spaces) is echoed correctly by select_tool_w_env. Rather, the problem seems to be the fact that select_tool expects a space-separated list of binaries to check for, rather than a single possibly whitespace-containing name.
In some cases, especially when using autotools, the value of
CCorCXXmay have spaces in it. For example, in my projectCXXis detected asg++ -std=c++17. Should the-std=c++17part really be inCXXFLAGS? Absolutely, but autotools isn't going to make that easy. Other examples arempicc -cc=clang(MPICH) or if using an absolute path with spaces.configuredoesn't seem to handle this gracefully and just takes the first word, e.g. truncatingg++ -std=c++17tog++. The correct value (with spaces) is echoed correctly byselect_tool_w_env. Rather, the problem seems to be the fact thatselect_toolexpects a space-separated list of binaries to check for, rather than a single possibly whitespace-containing name.