mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
Enable link-time optimization for central libraries with clang.
This commit is contained in:
parent
cc8f36ea7f
commit
5ea8ac362c
3 changed files with 23 additions and 14 deletions
29
configure.ac
29
configure.ac
|
@ -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"
|
||||
|
|
|
@ -27,6 +27,10 @@ AM_LDFLAGS = \
|
|||
@EXTRA_LDFLAGS@ \
|
||||
###
|
||||
|
||||
if LTO
|
||||
AM_CXXFLAGS += -flto
|
||||
endif
|
||||
|
||||
if DEBUG
|
||||
if GCC
|
||||
AM_CXXFLAGS += -fmax-errors=2
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue