comparison 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
comparison
equal deleted inserted replaced
2103:d84a0783ce11 2104:5ffcb4e10e1b
39 39
40 SV_CHECK_QT 40 SV_CHECK_QT
41 41
42 SV_DEFINES_DEBUG="-DDEBUG -DBUILD_DEBUG -DWANT_TIMING" 42 SV_DEFINES_DEBUG="-DDEBUG -DBUILD_DEBUG -DWANT_TIMING"
43 SV_DEFINES_RELEASE="-DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS" 43 SV_DEFINES_RELEASE="-DNDEBUG -DBUILD_RELEASE -DNO_TIMING -DNO_HIT_COUNTS"
44 SV_DEFINES_MINIMAL="$SV_DEFINES_RELEASE"
45 44
46 # Now we have: USER_CXXFLAGS contains any flags the user set 45 # Now we have: USER_CXXFLAGS contains any flags the user set
47 # explicitly; AUTOCONF_CXXFLAGS contains flags that Autoconf thought 46 # explicitly; AUTOCONF_CXXFLAGS contains flags that Autoconf thought
48 # we should use. If we have GCC, we override the latter but then 47 # we should use. If we have GCC, we override the latter but then
49 # allow ourselves to be overridden (later) by the former 48 # allow ourselves to be overridden (later) by the former
50 49
51 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS" 50 CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS"
51 OPTFLAGS_DEBUG="-O2"
52 LDFLAGS_DEBUG=""
52 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" 53 CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS"
53 CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" 54 OPTFLAGS_RELEASE="-O2"
55 LDFLAGS_RELEASE=""
54 CXXSTANDARD=c++14 56 CXXSTANDARD=c++14
55 57
56 if test "x$GCC" = "xyes"; then 58 if test "x$GCC" = "xyes"; then
57 CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" 59 CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe"
58 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -O2 -Werror" 60 CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -Werror"
59 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math" 61 OPTFLAGS_DEBUG="-O2"
60 CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" 62 CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0"
63 LDFLAGS_RELEASE="-fuse-linker-plugin"
64 OPTFLAGS_RELEASE="-O3 -ffast-math -flto"
61 LIBS_DEBUG="$LIBS" 65 LIBS_DEBUG="$LIBS"
62 AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11]) 66 AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11])
63 CXXSTANDARD=c++11]) 67 CXXSTANDARD=c++11])
64 fi 68 fi
65 69
66 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" 70 CXXFLAGS_BUILD="$CXXFLAGS_RELEASE $OPTFLAGS_RELEASE"
71 LDFLAGS_BUILD="$LDFLAGS_RELEASE $OPTFLAGS_RELEASE"
67 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE" 72 SV_DEFINES_BUILD="$SV_DEFINES_RELEASE"
68 73
69 QMAKE_CONFIG="release" 74 QMAKE_CONFIG="release"
70 75
71 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build]) 76 AC_ARG_ENABLE(debug, [AS_HELP_STRING([--enable-debug],[enable debug support [default=no]])],[AC_MSG_NOTICE([enabling debug build])
72 QMAKE_CONFIG="debug" 77 QMAKE_CONFIG="debug"
73 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG" 78 CXXFLAGS_BUILD="$CXXFLAGS_DEBUG $OPTFLAGS_DEBUG"
79 LDFLAGS_BUILD="$LDFLAGS_DEBUG"
74 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG" 80 SV_DEFINES_BUILD="$SV_DEFINES_DEBUG"
75 LIBS="$LIBS_DEBUG"]) 81 LIBS="$LIBS_DEBUG"])
76 82
77 if test x"$USER_CXXFLAGS" != x; then 83 if test x"$USER_CXXFLAGS" != x; then
78 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".]) 84 AC_MSG_NOTICE([The CXXFLAGS environment variable is set to "$USER_CXXFLAGS".])
79 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.) 85 AC_MSG_NOTICE(Overriding default compiler flags with the above user setting.)
80 CXXFLAGS_BUILD="$USER_CXXFLAGS" 86 CXXFLAGS_BUILD="$USER_CXXFLAGS"
81 CXXFLAGS_MINIMAL="$USER_CXXFLAGS" 87 LDFLAGS_BUILD=""
82 fi 88 fi
83 89
84 CXXFLAGS="$CXXFLAGS_BUILD $SV_DEFINES_BUILD" 90 CXXFLAGS="$CXXFLAGS_BUILD $SV_DEFINES_BUILD"
91 LDFLAGS="$LDFLAGS_BUILD"
85 92
86 SV_MODULE_REQUIRED([bz2],[],[bzlib.h],[bz2],[BZ2_bzReadOpen]) 93 SV_MODULE_REQUIRED([bz2],[],[bzlib.h],[bz2],[BZ2_bzReadOpen])
87 SV_MODULE_REQUIRED([fftw3],[fftw3 >= 3.0.0],[fftw3.h],[fftw3],[fftw_execute]) 94 SV_MODULE_REQUIRED([fftw3],[fftw3 >= 3.0.0],[fftw3.h],[fftw3],[fftw_execute])
88 SV_MODULE_REQUIRED([fftw3f],[fftw3f >= 3.0.0],[fftw3.h],[fftw3f],[fftwf_execute]) 95 SV_MODULE_REQUIRED([fftw3f],[fftw3f >= 3.0.0],[fftw3.h],[fftw3f],[fftwf_execute])
89 SV_MODULE_REQUIRED([sndfile],[sndfile >= 1.0.16],[sndfile.h],[sndfile],[sf_open]) 96 SV_MODULE_REQUIRED([sndfile],[sndfile >= 1.0.16],[sndfile.h],[sndfile],[sf_open])
128 AC_SUBST(SHA1SUM) 135 AC_SUBST(SHA1SUM)
129 AC_SUBST(CUT) 136 AC_SUBST(CUT)
130 137
131 AC_SUBST(CFLAGS) 138 AC_SUBST(CFLAGS)
132 AC_SUBST(CXXFLAGS) 139 AC_SUBST(CXXFLAGS)
133 AC_SUBST(CXXFLAGS_MINIMAL)
134 AC_SUBST(CXXSTANDARD) 140 AC_SUBST(CXXSTANDARD)
135 AC_SUBST(LDFLAGS) 141 AC_SUBST(LDFLAGS)
136 AC_SUBST(HAVES) 142 AC_SUBST(HAVES)
137 AC_SUBST(LIBS) 143 AC_SUBST(LIBS)
138 144