Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions build/common.m4
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ EOF
if test -n "$CXX"; then
echo "CXX=\"$CXX\"; export CXX" >> $1
fi
if test -n "$LD"; then
echo "LD=\"$LD\"; export LD" >> $1
fi
if test -n "$CFLAGS"; then
echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1
fi
Expand Down
25 changes: 25 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ AC_ARG_ENABLE([tsan],
)
AC_MSG_RESULT([$enable_tsan])

#
# Enable Link Time Optimization. This may need different settings per compiler?
#
AC_MSG_CHECKING([whether to enable LTO])
AC_ARG_ENABLE([lto],
[AS_HELP_STRING([--enable-lto],[turn on Link Time Optimization])],
[],
[enable_lto=no]
)
AC_MSG_RESULT([$enable_lto])

#
# Fast SDK APIs, this disables the parameter checks (assert)
# on all APIs.
Expand Down Expand Up @@ -938,6 +949,19 @@ AS_IF([test x"$enable_werror" = "xyes"], [
TS_ADDTO(debug_opt, -Werror)
])

# Add the necessary flags for LTO
AS_IF([test x"$enable_lto" = "xyes"], [
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xclang"], [
TS_ADDTO(AM_CXXFLAGS, [-flto=thin -fuse-ld=lld])
TS_ADDTO(AM_CFLAGS, [-flto=thin -fuse-ld=lld])
TS_ADDTO(AM_LDFLAGS, [-flto=thin -fuse-ld=lld])
], [
TS_ADDTO(AM_CXXFLAGS, [-flto])
TS_ADDTO(AM_CFLAGS, [-flto])
TS_ADDTO(AM_LDFLAGS, [-flto])
])
])

cc_oflag_opt=$release_opt
cc_oflag_dbg=$debug_opt
cxx_oflag_opt="$release_opt $cxx_opt $cxx_rel"
Expand Down Expand Up @@ -2419,6 +2443,7 @@ AC_MSG_NOTICE([Build option summary:
CC: $CC
CXX: $CXX
CPP: $CPP
LD: $LD
CFLAGS: $CFLAGS
CXXFLAGS: $CXXFLAGS
CPPFLAGS: $CPPFLAGS
Expand Down