diff options
author | Petri Savolainen <petri.savolainen@nokia.com> | 2019-06-26 13:47:36 +0300 |
---|---|---|
committer | Petri Savolainen <petri.savolainen@nokia.com> | 2019-07-01 13:45:09 +0300 |
commit | de7c1b2d50edf15815f8c908d09a5cffb1a4ae99 (patch) | |
tree | 40d932be962ffd8125c3d8fd9b4d6ddf19aa38f9 /configure.ac | |
parent | 39c9f9f9d33ccebc2a371da45b7ac19d83ff4899 (diff) |
configure: add --enable-lto option
Added option to build with link time optimization (-flto flag).
Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 536999386..a90993e41 100644 --- a/configure.ac +++ b/configure.ac @@ -239,6 +239,24 @@ AC_ARG_ENABLE([abi-compat], AM_CONDITIONAL(ODP_ABI_COMPAT, [test "x$ODP_ABI_COMPAT" = "x1"]) ########################################################################## +# Enable/disable link time optimization +########################################################################## +lto_enabled=no +AC_ARG_ENABLE([lto], + [AS_HELP_STRING([--enable-lto], + [Enable Link Time Optimization (LTO) in compiler and linker])], + [if test "x$enableval" = "xyes"; then + lto_enabled=yes + # Fat LTO object file contains GIMPLE bytecodes and the usual + # final code. There are less build problems (e.g. due to older + # binutils), but object files are larger. + ODP_LTO_FLAGS="-flto -ffat-lto-objects" + fi]) +AC_SUBST(ODP_LTO_FLAGS) + +ODP_CFLAGS="$ODP_CFLAGS $ODP_LTO_FLAGS" + +########################################################################## # Determine which platform to build for ########################################################################## AC_ARG_WITH([platform], @@ -383,6 +401,7 @@ AC_SUBST(ODP_DEPRECATED_API) ########################################################################## CFLAGS="$CFLAGS $ODP_CFLAGS" CXXFLAGS="$CXXFLAGS $ODP_CXXFLAGS" +LDFLAGS="$LDFLAGS $ODP_LTO_FLAGS" AC_CONFIG_FILES([Makefile]) AC_CONFIG_FILES([include/Makefile @@ -436,7 +455,8 @@ AC_MSG_RESULT([ static libraries: ${enable_static} shared libraries: ${enable_shared} ABI compatible: ${abi_compat} - Deprecated APIs: ${deprecated} + link time optimization: ${lto_enabled} + deprecated APIs: ${deprecated} debug: ${enable_debug} cunit: ${cunit_support} static tests linkage: ${enable_static_applications} |