Commit 59de2909 authored by Peter Trommler's avatar Peter Trommler 🥁 Committed by Ben Gamari

Update autoconf test for gcc to require 4.7 and up

Fixing #14244 required the newer gcc atomic built-ins that are provided
from 4.7 and up. This updates the test to check for minimum gcc version
4.7.

The version tests for 3.4 (!), 4.4, and 4.6 are no longer needed and can
be removed. This makes the build system simpler.

Test Plan: validate

Reviewers: austin, bgamari, hvr, simonmar

Reviewed By: bgamari

Subscribers: rwbarton, thomie, erikd

Differential Revision: https://phabricator.haskell.org/D4165
parent 8613e61d
...@@ -1229,27 +1229,15 @@ if test -z "$CC" ...@@ -1229,27 +1229,15 @@ if test -z "$CC"
then then
AC_MSG_ERROR([gcc is required]) AC_MSG_ERROR([gcc is required])
fi fi
GccLT34=NO
GccLT44=NO
GccLT46=NO
AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version], AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version],
[ [
# Be sure only to look at the first occurrence of the "version " string; # Be sure only to look at the first occurrence of the "version " string;
# Some Apple compilers emit multiple messages containing this string. # Some Apple compilers emit multiple messages containing this string.
fp_cv_gcc_version="`$CC -v 2>&1 | sed -n -e '1,/version /s/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/p'`" fp_cv_gcc_version="`$CC -v 2>&1 | sed -n -e '1,/version /s/.*version [[^0-9]]*\([[0-9.]]*\).*/\1/p'`"
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.0], FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.7],
[AC_MSG_ERROR([Need at least gcc version 3.0 (3.4+ recommended)])]) [AC_MSG_ERROR([Need at least gcc version 4.7])])
# See #2770: gcc 2.95 doesn't work any more, apparently. There probably
# isn't a very good reason for that, but for now just make configure
# fail.
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.4], GccLT34=YES)
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.4], GccLT44=YES)
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.6], GccLT46=YES)
]) ])
AC_SUBST([GccVersion], [$fp_cv_gcc_version]) AC_SUBST([GccVersion], [$fp_cv_gcc_version])
AC_SUBST(GccLT34)
AC_SUBST(GccLT44)
AC_SUBST(GccLT46)
])# FP_GCC_VERSION ])# FP_GCC_VERSION
dnl Check to see if the C compiler is clang or llvm-gcc dnl Check to see if the C compiler is clang or llvm-gcc
......
...@@ -522,9 +522,6 @@ GccVersion = @GccVersion@ ...@@ -522,9 +522,6 @@ GccVersion = @GccVersion@
# TargetPlatformFull retains the string passed to configure so we have it in # TargetPlatformFull retains the string passed to configure so we have it in
# the necessary format to pass to libffi's configure. # the necessary format to pass to libffi's configure.
TargetPlatformFull = @TargetPlatformFull@ TargetPlatformFull = @TargetPlatformFull@
GccLT34 = @GccLT34@
GccLT44 = @GccLT44@
GccLT46 = @GccLT46@
GccIsClang = @GccIsClang@ GccIsClang = @GccIsClang@
CC = @CC@ CC = @CC@
......
...@@ -20,21 +20,17 @@ GhcStage2HcOpts += -Wcpp-undef ...@@ -20,21 +20,17 @@ GhcStage2HcOpts += -Wcpp-undef
ifneq "$(GccIsClang)" "YES" ifneq "$(GccIsClang)" "YES"
# Debian doesn't turn -Werror=unused-but-set-variable on by default, so # Debian doesn't turn -Werror=unused-but-set-variable on by default, so
# we turn it on explicitly for consistency with other users # we turn it on explicitly for consistency with other users.
ifeq "$(GccLT46)" "NO"
# Never set the flag on Windows as the host gcc may be too old. # Never set the flag on Windows as the host gcc may be too old.
ifneq "$(HostOS_CPP)" "mingw32" ifneq "$(HostOS_CPP)" "mingw32"
SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
endif endif
endif
ifeq "$(GccLT44)" "NO"
# Suppress the warning about __sync_fetch_and_nand (#9678). # Suppress the warning about __sync_fetch_and_nand (#9678).
libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand
# gcc 4.6 gives 3 warnings for giveCapabilityToTask not being inlined # gcc 4.6 gives 3 warnings for giveCapabilityToTask not being inlined
# gcc 4.4 gives 2 warnings for lockClosure not being inlined # gcc 4.4 gives 2 warnings for lockClosure not being inlined
SRC_CC_WARNING_OPTS += -Wno-error=inline SRC_CC_WARNING_OPTS += -Wno-error=inline
endif
else else
......
...@@ -301,11 +301,7 @@ $(eval $(call distdir-opts,rts,dist,1)) ...@@ -301,11 +301,7 @@ $(eval $(call distdir-opts,rts,dist,1))
# We like plenty of warnings. # We like plenty of warnings.
WARNING_OPTS += -Wall WARNING_OPTS += -Wall
ifeq "$(GccLT34)" "YES"
WARNING_OPTS += -W
else
WARNING_OPTS += -Wextra WARNING_OPTS += -Wextra
endif
WARNING_OPTS += -Wstrict-prototypes WARNING_OPTS += -Wstrict-prototypes
WARNING_OPTS += -Wmissing-prototypes WARNING_OPTS += -Wmissing-prototypes
WARNING_OPTS += -Wmissing-declarations WARNING_OPTS += -Wmissing-declarations
...@@ -315,9 +311,7 @@ WARNING_OPTS += -Wpointer-arith ...@@ -315,9 +311,7 @@ WARNING_OPTS += -Wpointer-arith
WARNING_OPTS += -Wmissing-noreturn WARNING_OPTS += -Wmissing-noreturn
WARNING_OPTS += -Wnested-externs WARNING_OPTS += -Wnested-externs
WARNING_OPTS += -Wredundant-decls WARNING_OPTS += -Wredundant-decls
ifeq "$(GccLT46)" "NO"
WARNING_OPTS += -Wundef WARNING_OPTS += -Wundef
endif
# These ones are hard to avoid: # These ones are hard to avoid:
#WARNING_OPTS += -Wconversion #WARNING_OPTS += -Wconversion
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment