summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorSven Eden <yamakuzure@gmx.net>2017-07-21 13:37:31 +0200
committerSven Eden <yamakuzure@gmx.net>2017-07-26 10:16:50 +0200
commit7e17c59e6b33219e1d478a74852a64d4c726d76b (patch)
tree4d222733fc7c2044e9de1692c2633c79e33d625e /configure.ac
parent39584e4d26d7ba7d144d9c1872fcf2045069c5e2 (diff)
Prep v233.4: Update LTO usage to be more convenient.
- Add -fuse-linker-plugin to work around odd compiler and binutils installs. Should fix most "plugin needed to handle lto object" issues. - Read back whether LTO really has been enabled or not, so we can display a status line at the end of configure. - Only enforce gold linker if LTO has been enabled. These checks can still be disabled with the --disable-lto option, which will make configure to skip all checks regarding LTO.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac16
1 files changed, 12 insertions, 4 deletions
diff --git a/configure.ac b/configure.ac
index df38297bf..e67cbdd60 100644
--- a/configure.ac
+++ b/configure.ac
@@ -247,14 +247,20 @@ AS_CASE([$CC], [*clang*],
])])
# ------------------------------------------------------------------------------
+have_lto=no
AC_ARG_ENABLE([lto], [AS_HELP_STRING([--disable-lto], [disable -flto])],
[], [enable_lto=yes])
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
- [AS_IF([test "x$enable_lto" = "xyes"],
- [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto])],
+ [AS_IF([test "x$enable_lto" = "xyes"], [have_lto=yes],
[AC_MSG_RESULT([disabling -flto as requested])])],
[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+AS_IF([test "x$have_lto" = "xyes"],
+ [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS],
+ [-flto -fuse-linker-plugin])])
+
+AS_CASE([$with_cflags], [*-flto*], [], [have_lto=no])
+
# ------------------------------------------------------------------------------
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cppflags], [CPPFLAGS], [\
@@ -279,8 +285,9 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
-Wl,--no-undefined \
-Wl,-z,relro \
-Wl,-z,now \
- -pie \
- -Wl,-fuse-ld=gold])
+ -pie])
+AS_IF([test "x$have_lto" = "xyes"],
+ [CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [-Wl,-fuse-ld=gold])])
# ------------------------------------------------------------------------------
AC_SUBST([OUR_CPPFLAGS], "$with_cppflags $sanitizer_cppflags")
@@ -865,6 +872,7 @@ AC_MSG_RESULT([
test coverage: . . . . . . . . . . ${have_coverage}
Split /usr: . . . . . . . . . . . ${enable_split_usr}
utmp/wtmp support: . . . . . . . . ${have_utmp}
+ Link time optimization: . . . . . ${have_lto}
extra debugging: . . . . . . . . . ${enable_debug}
cgroup controller: . . . . . . . . ${with_cgroupctrl}