Paul Eggert <egg...@cs.ucla.edu> writes: > 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.
There is a long-standing libtool issue with the work-around to use CC='gcc -static-libgcc', and it is still the preferred way (as far as I know) to build usable executables for Mingw32: http://mingw-users.1079350.n2.nabble.com/Building-DLLs-that-don-t-depend-on-libgcc-s-dw2-1-dll-td7582938.html#a7582940 I think it should be fine to have parameters in CC, and I often use that when I want to force certain compilation behaviour. /Simon
signature.asc
Description: PGP signature