Enable Link Time Optimization by default

This commit is contained in:
Andrzej Rybczak
2020-12-22 20:26:11 +01:00
parent d402df8eeb
commit 628f7ee1c4
2 changed files with 21 additions and 0 deletions

View File

@@ -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.

View File

@@ -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"