Improve gcc detection in configure script (#2897)

Improve gcc detection in configure script

We have been detecting gcc by the CC variable but this fails under
ubuntu for example where you might specify CC='gcc-8' to ./configure. 
Also consider clang impersonator to be gcc.

Related to #2890
This commit is contained in:
Paulo Matos 2019-11-12 19:26:36 +01:00 committed by GitHub
parent 3cb41850fa
commit b6627956b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -4610,7 +4610,13 @@ SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} AR_FLAGS="'"'"${ARFLAGS}"'"'
is_gmake=`make -v no-such-target-we-hope 2>&1 | grep "GNU Make"`
# If using gcc, we want all warnings:
if test "$CC" = "gcc" ; then
is_gcc=`$CC -v 2>&1 | tail -n 1 | grep -E '^gcc version [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ \([^\)]+\)[[:space:]]*$'`
# We also need to test if $CC is gcc itself because on mac,
# where clang impersonates gcc, although is_gcc is false, we want
# to use it as if it was gcc.
# See https://github.com/racket/racket/pull/2897#pullrequestreview-314906673
if test "$is_gcc" != "" || test "`basename $CC`" = "gcc"; then
COMPFLAGS="$COMPFLAGS -Wall"
# Use -MMD when we have gcc and gnumake:

View File

@ -463,7 +463,15 @@ SUB_CONFIGURE_EXTRAS="${SUB_CONFIGURE_EXTRAS} AR_FLAGS="'"'"${ARFLAGS}"'"'
is_gmake=`make -v no-such-target-we-hope 2>&1 | grep "GNU Make"`
# If using gcc, we want all warnings:
if test "$CC" = "gcc" ; then
changequote(<<, >>)dnl
is_gcc=`$CC -v 2>&1 | tail -n 1 | grep -E '^gcc version [[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+ \([^\)]+\)[[:space:]]*$'`
changequote([, ])dnl
# We also need to test if $CC is gcc itself because on mac,
# where clang impersonates gcc, although is_gcc is false, we want
# to use it as if it was gcc.
# See https://github.com/racket/racket/pull/2897#pullrequestreview-314906673
if test "$is_gcc" != "" || test "`basename $CC`" = "gcc"; then
COMPFLAGS="$COMPFLAGS -Wall"
# Use -MMD when we have gcc and gnumake: