On 1/25/21 7:55 PM, Jeffrey Walton wrote:
Jeffrey Walton wrote:
Placing flags in CC breaks other scripts. For example, this no longer works:
if [[ ! $(command -v "${CC}") ]]; then
echo "The compiler is not valid. Please install a compiler."
exit 1
fi
You can easily work around this problem by creating whatever compiler
you like as a script. For example, create an executable file mycc in
your PATH with this contents:
#!/bin/sh
exec gcc -m32 "$@"
and then use './configure CC=mycc'.
Some flags, like '-m32' or '-m64', MUST be
put in $CC. [1]
I place them where they belong - in CFLAGS and CXXFLAGS.
Where they belong is a matter of opinion. In practice, I prefer the
method that Bruno suggested, as it follows the usual practice for
cross-compiling. Flags like -m32 are significant enough that they are
more like using a cross-compiler and so "belong" in CC more than in CFLAGS.