diff configure.ac @ 2104:5ffcb4e10e1b

Experiment with LTO on gcc build
author Chris Cannam
date Thu, 15 Nov 2018 13:05:20 +0000
parents 810a0b8f5472
children f474b3931217
line wrap: on
line diff
--- a/configure.ac	Thu Nov 15 09:03:51 2018 +0000
+++ b/configure.ac	Thu Nov 15 13:05:20 2018 +0000
@@ -41,7 +41,6 @@
 
 SV_DEFINES_DEBUG="-DDEBUG -DBUILD_DEBUG -DWANT_TIMING"
 SV_DEFINES_RELEASE="-DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS"
-SV_DEFINES_MINIMAL="$SV_DEFINES_RELEASE"
 
 # Now we have: USER_CXXFLAGS contains any flags the user set
 # explicitly; AUTOCONF_CXXFLAGS contains flags that Autoconf thought
@@ -49,28 +48,35 @@
 # allow ourselves to be overridden (later) by the former
 
 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS"
+OPTFLAGS_DEBUG="-O2"
+LDFLAGS_DEBUG=""
 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
-CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS"
+OPTFLAGS_RELEASE="-O2"
+LDFLAGS_RELEASE=""
 CXXSTANDARD=c++14
 
 if test "x$GCC" = "xyes"; then
    	CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
-        CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -O2 -Werror"
-   	CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math"
-   	CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0"
+        CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror"
+        OPTFLAGS_DEBUG="-O2"
+   	CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0"
+        LDFLAGS_RELEASE="-fuse-linker-plugin"
+        OPTFLAGS_RELEASE="-O3 -ffast-math -flto"
         LIBS_DEBUG="$LIBS"
         AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11])
         CXXSTANDARD=c++11])
 fi
 
-CXXFLAGS_BUILD="$CXXFLAGS_RELEASE"
+CXXFLAGS_BUILD="$CXXFLAGS_RELEASE $OPTFLAGS_RELEASE"
+LDFLAGS_BUILD="$LDFLAGS_RELEASE $OPTFLAGS_RELEASE"
 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE"
 
 QMAKE_CONFIG="release"
 
 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build])
 QMAKE_CONFIG="debug"
-CXXFLAGS_BUILD="$CXXFLAGS_DEBUG"
+CXXFLAGS_BUILD="$CXXFLAGS_DEBUG $OPTFLAGS_DEBUG"
+LDFLAGS_BUILD="$LDFLAGS_DEBUG"
 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"
 LIBS="$LIBS_DEBUG"])
 
@@ -78,10 +84,11 @@
    	AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".])
 	AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.)
 	CXXFLAGS_BUILD="$USER_CXXFLAGS"
-	CXXFLAGS_MINIMAL="$USER_CXXFLAGS"
+        LDFLAGS_BUILD=""
 fi
 
 CXXFLAGS="$CXXFLAGS_BUILD $SV_DEFINES_BUILD"
+LDFLAGS="$LDFLAGS_BUILD"
 
 SV_MODULE_REQUIRED([bz2],[],[bzlib.h],[bz2],[BZ2_bzReadOpen])
 SV_MODULE_REQUIRED([fftw3],[fftw3 >= 3.0.0],[fftw3.h],[fftw3],[fftw_execute])
@@ -130,7 +137,6 @@
 
 AC_SUBST(CFLAGS)
 AC_SUBST(CXXFLAGS)
-AC_SUBST(CXXFLAGS_MINIMAL)
 AC_SUBST(CXXSTANDARD)
 AC_SUBST(LDFLAGS)
 AC_SUBST(HAVES)