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"
then
AC_MSG_ERROR([gcc is required])
fi
GccLT34=NO
GccLT44=NO
GccLT46=NO
AC_CACHE_CHECK([version of gcc], [fp_cv_gcc_version],
[
# Be sure only to look at the first occurrence of the "version " 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_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [3.0],
[AC_MSG_ERROR([Need at least gcc version 3.0 (3.4+ recommended)])])
# 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)
FP_COMPARE_VERSIONS([$fp_cv_gcc_version], [-lt], [4.7],
[AC_MSG_ERROR([Need at least gcc version 4.7])])
])
AC_SUBST([GccVersion], [$fp_cv_gcc_version])
AC_SUBST(GccLT34)
AC_SUBST(GccLT44)
AC_SUBST(GccLT46)
])# FP_GCC_VERSION
dnl Check to see if the C compiler is clang or llvm-gcc
......
......@@ -522,9 +522,6 @@ GccVersion = @GccVersion@
# TargetPlatformFull retains the string passed to configure so we have it in
# the necessary format to pass to libffi's configure.
TargetPlatformFull = @TargetPlatformFull@
GccLT34 = @GccLT34@
GccLT44 = @GccLT44@
GccLT46 = @GccLT46@
GccIsClang = @GccIsClang@
CC = @CC@
......
......@@ -20,21 +20,17 @@ GhcStage2HcOpts += -Wcpp-undef
ifneq "$(GccIsClang)" "YES"
# Debian doesn't turn -Werror=unused-but-set-variable on by default, so
# we turn it on explicitly for consistency with other users
ifeq "$(GccLT46)" "NO"
# we turn it on explicitly for consistency with other users.
# Never set the flag on Windows as the host gcc may be too old.
ifneq "$(HostOS_CPP)" "mingw32"
SRC_CC_WARNING_OPTS += -Werror=unused-but-set-variable
endif
endif
ifeq "$(GccLT44)" "NO"
# Suppress the warning about __sync_fetch_and_nand (#9678).
libraries/ghc-prim/cbits/atomic_CC_OPTS += -Wno-sync-nand
# gcc 4.6 gives 3 warnings for giveCapabilityToTask not being inlined
# gcc 4.4 gives 2 warnings for lockClosure not being inlined
SRC_CC_WARNING_OPTS += -Wno-error=inline
endif
else
......
......@@ -301,11 +301,7 @@ $(eval $(call distdir-opts,rts,dist,1))
# We like plenty of warnings.
WARNING_OPTS += -Wall
ifeq "$(GccLT34)" "YES"
WARNING_OPTS += -W
else
WARNING_OPTS += -Wextra
endif
WARNING_OPTS += -Wstrict-prototypes
WARNING_OPTS += -Wmissing-prototypes
WARNING_OPTS += -Wmissing-declarations
......@@ -315,9 +311,7 @@ WARNING_OPTS += -Wpointer-arith
WARNING_OPTS += -Wmissing-noreturn
WARNING_OPTS += -Wnested-externs
WARNING_OPTS += -Wredundant-decls
ifeq "$(GccLT46)" "NO"
WARNING_OPTS += -Wundef
endif
# These ones are hard to avoid:
#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