summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Deller <luke@deller.id.au>2015-01-14 23:48:36 +1100
committerMichael Stahl <mstahl@redhat.com>2016-12-01 16:48:52 +0000
commitd6a1ba29a512aec9b4aa3d0ab4bd6b92aea7fef4 (patch)
treebb6aa0195834633dcf7745167f6bdaf38a3396f0
parentc623a9f846c713b19a0d58337af4f4354aeffa6e (diff)
enable optimization (-Og) with --enable-debug
gcc-4.8 introduced a new optimization level -Og which enables optimizations that do not interfere with debugging. When configured with --enable-debug, use -Og rather than -O0 if available. Change-Id: Iff3f98d736681ae34e49b96510228a14ce456b34 Reviewed-on: https://gerrit.libreoffice.org/31333 Reviewed-by: Michael Stahl <mstahl@redhat.com> Tested-by: Michael Stahl <mstahl@redhat.com>
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac15
2 files changed, 16 insertions, 0 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 9bf9d69f3a4f..918174891e0b 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -244,6 +244,7 @@ export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@
export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@
export HAVE_GCC_FNO_SIZED_DEALLOCATION=@HAVE_GCC_FNO_SIZED_DEALLOCATION@
export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@
+export HAVE_GCC_OG=@HAVE_GCC_OG@
export HAVE_GCC_PRAGMA_OPERATOR=@HAVE_GCC_PRAGMA_OPERATOR@
export HAVE_GNUMAKE_FILE_FUNC=@HAVE_GNUMAKE_FILE_FUNC@
export HAVE_LD_BSYMBOLIC_FUNCTIONS=@HAVE_LD_BSYMBOLIC_FUNCTIONS@
diff --git a/configure.ac b/configure.ac
index 77fefaa1dc88..082b311f063b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3733,6 +3733,7 @@ fi
HAVE_GCC_GGDB2=
HAVE_GCC_FINLINE_LIMIT=
HAVE_GCC_FNO_INLINE=
+HAVE_GCC_OG=
if test "$GCC" = "yes"; then
AC_MSG_CHECKING([whether $CC supports -ggdb2])
if test -n "$CLANGVER" -a 0"$CLANGVER" -le 30100; then
@@ -3782,10 +3783,24 @@ if test "$GCC" = "yes"; then
else
AC_MSG_RESULT([no])
fi
+
+ AC_MSG_CHECKING([whether $CC supports -Og])
+ # Note that clang-3.1 reports a real error for this option
+ # so we do not need a special case for clang<=3.1 as above.
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -Werror -Og"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], [[ return 0; ]])],[ HAVE_GCC_OG=TRUE ],[])
+ CFLAGS=$save_CFLAGS
+ if test "$HAVE_GCC_OG" = "TRUE"; then
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
fi
AC_SUBST(HAVE_GCC_GGDB2)
AC_SUBST(HAVE_GCC_FINLINE_LIMIT)
AC_SUBST(HAVE_GCC_FNO_INLINE)
+AC_SUBST(HAVE_GCC_OG)
dnl ===================================================================
dnl Test the gcc version