diff --git a/racket/src/cfg-racket b/racket/src/cfg-racket index abd2b2710e..b3af235ef6 100755 --- a/racket/src/cfg-racket +++ b/racket/src/cfg-racket @@ -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: diff --git a/racket/src/racket/configure.ac b/racket/src/racket/configure.ac index c563aa4409..ed0c5bd171 100644 --- a/racket/src/racket/configure.ac +++ b/racket/src/racket/configure.ac @@ -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: