From 56acea8345eaa0961f12bfc2383c14676054665d Mon Sep 17 00:00:00 2001 From: marxin Date: Fri, 26 May 2017 14:58:39 +0200 Subject: [PATCH] Add -O2 to stage1_cflags for experimental branch. ChangeLog: 2017-05-26 Martin Liska * configure.ac: Add -O2 to stage1_cflags for experimental branch. * configure: Regenerate. --- configure | 23 +++++++++++++++++++++++ configure.ac | 21 +++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/configure b/configure index 82aa619fad1..079bad6bf34 100755 --- a/configure +++ b/configure @@ -7080,6 +7080,24 @@ fi $as_echo "$BUILD_CONFIG" >&6; } +# Detect if compiler is GCC >= 4.8.x +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CC is recent compiler" >&5 +$as_echo_n "checking CC is recent compiler... " >&6; } +cc_is_recent_gcc= +version_output=`${CC} -v 2>&1 | grep 'gcc version'` + +if test "x${version_output}" != x; then + version=`echo ${version_output} | sed 's/gcc version \([^ ]*\).*/\\1/'` + major=`echo ${version} | cut -d. -f1` + minor=`echo ${version} | cut -d. -f2` + + if test "${major}" -ge 5 || ( test "${major}" -eq 4 && test "${minor}" -ge 8 ); then + cc_is_recent_gcc=yes + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cc_is_recent_gcc" >&5 +$as_echo "$cc_is_recent_gcc" >&6; } + # Use same top-level configure hooks in libgcc/libstdc++/libvtv. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for --enable-vtable-verify" >&5 $as_echo_n "checking for --enable-vtable-verify... " >&6; } @@ -14655,6 +14673,11 @@ if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; "") stage2_werror_flag="--enable-werror-always" ;; esac + + if test "$cc_is_recent_gcc" = "yes"; then + stage1_cflags="$stage1_cflags -O2" + + fi fi diff --git a/configure.ac b/configure.ac index 78d2d593106..d312e2e8347 100644 --- a/configure.ac +++ b/configure.ac @@ -2667,6 +2667,22 @@ fi AC_MSG_RESULT($BUILD_CONFIG) AC_SUBST(BUILD_CONFIG) +# Detect if compiler is GCC >= 4.8.x +AC_MSG_CHECKING(CC is recent compiler) +cc_is_recent_gcc= +version_output=`${CC} -v 2>&1 | grep 'gcc version'` + +if test "x${version_output}" != x; then + version=`echo ${version_output} | sed 's/gcc version \([[^ ]]*\).*/\\1/'` + major=`echo ${version} | cut -d. -f1` + minor=`echo ${version} | cut -d. -f2` + + if test "${major}" -ge 5 || ( test "${major}" -eq 4 && test "${minor}" -ge 8 ); then + cc_is_recent_gcc=yes + fi +fi +AC_MSG_RESULT($cc_is_recent_gcc) + # Use same top-level configure hooks in libgcc/libstdc++/libvtv. AC_MSG_CHECKING([for --enable-vtable-verify]) AC_ARG_ENABLE(vtable-verify, @@ -3521,6 +3537,11 @@ if test -d ${srcdir}/gcc && test x"`cat $srcdir/gcc/DEV-PHASE`" = xexperimental; "") stage2_werror_flag="--enable-werror-always" ;; esac + + if test "$cc_is_recent_gcc" = "yes"; then + stage1_cflags="$stage1_cflags -O2" + AC_SUBST(stage1_cflags) + fi fi AC_SUBST(stage2_werror_flag) -- 2.12.2