diff options
author | Andrzej Rybczak <andrzej@rybczak.net> | 2020-12-22 20:26:11 +0100 |
---|---|---|
committer | Andrzej Rybczak <andrzej@rybczak.net> | 2020-12-22 20:26:11 +0100 |
commit | 628f7ee1c41f406fb650378e79749e610ee0ee59 (patch) | |
tree | 0469a3726bc4b13689d4d22af6dd8c30935895b1 | |
parent | d402df8eeb0c6b62f9a55746549e824ca0a156c7 (diff) |
Enable Link Time Optimization by default
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | configure.ac | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 05e7015a..94c385a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Suppress output of all external commands. * Consider mouse support when pausing and unpausing curses interface. * Reduce CPU usage of the frequency spectrum visualizer. +* Enable Link Time Optimization by default. # ncmpcpp-0.9 (2020-12-20) * Fix various Mopidy specific bugs. diff --git a/configure.ac b/configure.ac index 8c2d85fd..ef0c52b7 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,7 @@ AC_ARG_ENABLE(clock, AS_HELP_STRING([--enable-clock], [Enable clock screen @<:@d AC_ARG_WITH(fftw, AS_HELP_STRING([--with-fftw], [Enable fftw support (required for frequency spectrum vizualization) @<:@default=auto@:>@]), [fftw=$withval], [fftw=auto]) AC_ARG_WITH(taglib, AS_HELP_STRING([--with-taglib], [Enable tag editor @<:@default=auto@:>@]), [taglib=$withval], [taglib=auto]) +AC_ARG_WITH(lto, AS_HELP_STRING([--with-lto], [Enable LTO (link time optimization) @<:@default=yes@:>@]), [lto=$withval], [lto=yes]) if test "$outputs" = "yes"; then AC_DEFINE([ENABLE_OUTPUTS], [1], [enables outputs screen]) @@ -26,6 +27,25 @@ if test "$clock" = "yes"; then AC_DEFINE([ENABLE_CLOCK], [1], [enables clock screen]) fi +# -flto +if test "$lto" != "no"; then + AC_MSG_CHECKING([whether compiler supports -flto]) + old_CXXFLAGS="$CXXFLAGS" + # support specifying the number of threads + if test "$lto" != "yes"; then + flto="-flto=$lto" + else + flto="-flto" + fi + CXXFLAGS="$flto" + AC_LINK_IFELSE([AC_LANG_PROGRAM([[ ]])], + AC_MSG_RESULT([yes]), + AC_MSG_RESULT([no]) + flto="" + ) + CXXFLAGS="$old_CXXFLAGS $flto" +fi + # -ftree-vectorize AC_MSG_CHECKING([whether compiler supports -ftree-vectorize]) old_CXXFLAGS="$CXXFLAGS" |