From 67bf5cb1a34c7dcb4081254a859bf82421be1d48 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Tue, 2 Dec 2014 12:41:20 -0600 Subject: [PATCH] build: add --enable-lto to enable Link Time Optimization (bgo #741140) Takes about 3x as long to build with gcc 4.8, but gcc 4.9 is supposed to speed that up considerably. Name Before After Saved ------------------------------------- NetworkManager 1734744 1689728 3% libnm 1263536 808816 36% nm-iface-helper 931136 906496 3% libnm-util 441264 437168 1% libnm-glib 297064 292960 2% https://bugzilla.gnome.org/show_bug.cgi?id=741140 --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/configure.ac b/configure.ac index afc55defa1..c1c8fde83f 100644 --- a/configure.ac +++ b/configure.ac @@ -821,6 +821,13 @@ AM_CONDITIONAL(BUILD_NMTUI, test "$build_nmtui" = yes) NM_COMPILER_WARNINGS +AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)]), + [enable_lto=yes], [enable_lto=no]) +if (test "${enable_lto}" = "yes"); then + CFLAGS="-flto $CFLAGS" +fi + + dnl ------------------------- dnl Vala bindings dnl ------------------------- @@ -1070,4 +1077,5 @@ echo " documentation: $enable_gtk_doc" echo " tests: $enable_tests" echo " valgrind: $with_valgrind" echo " code coverage: $enable_code_coverage" +echo " LTO: $enable_lto" echo