File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,17 @@ AC_ARG_ENABLE([tsan],
233233)
234234AC_MSG_RESULT ( [ $enable_tsan] )
235235
236+ #
237+ # Enable Link Time Optimization. This may need different settings per compiler?
238+ #
239+ AC_MSG_CHECKING ( [ whether to enable LTO] )
240+ AC_ARG_ENABLE ( [ lto] ,
241+ [ AS_HELP_STRING ( [ --enable-lto] ,[ turn on Link Time Optomization] ) ] ,
242+ [ ] ,
243+ [ enable_lto=no]
244+ )
245+ AC_MSG_RESULT ( [ $enable_lto] )
246+
236247#
237248# Fast SDK APIs, this disables the parameter checks (assert)
238249# on all APIs.
@@ -938,6 +949,13 @@ AS_IF([test x"$enable_werror" = "xyes"], [
938949 TS_ADDTO(debug_opt, -Werror)
939950] )
940951
952+ # Add the necessary flags for LTO, but only for release builds
953+ AS_IF ( [ test x"$enable_lto" = "xyes"] , [
954+ TS_ADDTO(AM_CXXFLAGS, "-flto")
955+ TS_ADDTO(AM_CFLAGS, "-flto")
956+ TS_ADDTO(AM_LDFLAGS, "-flto")
957+ ] )
958+
941959cc_oflag_opt=$release_opt
942960cc_oflag_dbg=$debug_opt
943961cxx_oflag_opt="$release_opt $cxx_opt $cxx_rel"
You can’t perform that action at this time.
0 commit comments