0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

Enable link-time optimization for central libraries with clang.

This commit is contained in:
Jason Volk 2020-04-17 21:21:28 -07:00
parent cc8f36ea7f
commit 5ea8ac362c
3 changed files with 23 additions and 14 deletions

View file

@ -237,16 +237,25 @@ dnl Explicit link-time-optimization switch
dnl
AC_MSG_CHECKING(whether to enable link-time optimization)
AC_ARG_ENABLE(lto, AC_HELP_STRING([--enable-lto], [Enable link-time optimization]),
AC_ARG_ENABLE(lto, AC_HELP_STRING([--disable-lto], [Enable link-time optimization]),
[
AC_MSG_RESULT([yes])
AC_SUBST(LTO, 1)
lto="no"
AC_MSG_RESULT([no, explicitly disabled])
], [
AM_COND_IF(DEBUG,
AM_COND_IF(OPTIMIZE,
[
AC_MSG_RESULT([no])
AM_COND_IF(CLANG,
[
lto="yes"
AC_MSG_RESULT([yes])
AC_SUBST(LTO, 1)
], [
lto="no"
AC_MSG_RESULT([no, only available with clang])
])
], [
AC_MSG_RESULT([no, link-time optimization is explicit-only at this time])
lto="no"
AC_MSG_RESULT([no, optimizations disabled])
])
])
@ -511,14 +520,6 @@ dnl
CXXFLAGS+=" -O$optimize_level"
AM_COND_IF([LTO],
[
lto="yes"
CXXFLAGS+=" -flto=`nproc`"
], [
lto="no"
])
AM_COND_IF([OPTIMIZE],
[
optimize="yes"

View file

@ -27,6 +27,10 @@ AM_LDFLAGS = \
@EXTRA_LDFLAGS@ \
###
if LTO
AM_CXXFLAGS += -flto
endif
if DEBUG
if GCC
AM_CXXFLAGS += -fmax-errors=2

View file

@ -35,6 +35,10 @@ if GCC
AM_CXXFLAGS += -ftls-model=local-dynamic
endif
if LTO
AM_CXXFLAGS += -flto
endif
if DEBUG
if GCC
AM_CXXFLAGS += -fmax-errors=3