disable user_redefine_cc when CC is $GCC
Fixes #21859 (closed) by extending logic to cover
user_redefine_cc
and user_redefine_cflags
as well as checking if user_redefine_cc
is GCC-like
This allows for additional flags to be loaded when running with CC=gcc-X
or even CC=clang
(but not for CC=tcc
)
tests
these were collected with autoreconf -i && ./configure CC=X > log; sed -n '12,16p' log; grep ": CC=" log
with some additional lines omitted by hand.
$ ./configure
checking for CC and CFLAGS in gmp.h... yes CC=gcc CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
checking whether CC=gcc and CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2 works... yes
checking for gcc... gcc
checking whether the C compiler works... yes
configure: CC=gcc, CFLAGS=-W -Wall -Wundef -O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
$ ./configure CC=gcc
(exact same as above)
$ ./configure CC=gcc-8
checking for CC and CFLAGS in gmp.h... yes CC=gcc CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
configure: overriding GMP_CC=gcc with CC=gcc-8
checking whether CC=gcc-8 and CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2 works... no, reverting to default
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc-8
checking whether the C compiler works... yes
configure: CC=gcc-8, CFLAGS=-W -Wall -Wundef -pedantic -g -O2
$ ./configure CC=gcc-9
checking for CC and CFLAGS in gmp.h... yes CC=gcc CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
configure: overriding GMP_CC=gcc with CC=gcc-9
checking whether CC=gcc-9 and CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2 works... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc-9
configure: CC=gcc-9, CFLAGS=-W -Wall -Wundef -O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
$ ./configure CC=clang
checking for CC and CFLAGS in gmp.h... yes CC=gcc CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
configure: overriding GMP_CC=gcc with CC=clang
checking whether CC=clang and CFLAGS=-O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2 works... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... clang
configure: CC=clang, CFLAGS=-W -Wall -Wundef -O2 -pedantic -fomit-frame-pointer -m64 -mtune=znver2 -march=znver2
$ ./configure CC=tcc
checking whether make supports the include directive... yes (GNU style)
checking for gcc... tcc
checking whether the C compiler works... yes
configure: CC=tcc, CFLAGS=-g
We can see that in all GCC like cases (gcc & clang) it now tries to load CFLAGS from gmp.h.
In the gcc-8
case this fails (--mtune=znver2
is not yet supported) and it falls back to setting some reasonable CFLAGS (Wall Wundef -pendantic) in the
The tcc
case is the same as before, CFLAGS is left mostly untouched.