1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-22 17:35:35 +03:00

build-sys: conditionally disable LTO if requested (#3823)

This adds a --disable-lto option to ./configure, but does not change the
default behavior.
This commit is contained in:
Davide Cavalca 2016-07-28 20:42:45 -07:00 committed by Zbigniew Jędrzejewski-Szmek
parent 689e4e6a94
commit 4e3382bdd7

View File

@ -211,9 +211,12 @@ AS_CASE([$CC], [*clang*],
-Wno-gnu-variable-sized-type-not-at-end \
])])
AC_ARG_ENABLE([lto], [AS_HELP_STRING([--disable-lto], [disable -flto])],
[], [enable_lto=yes])
AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-flto])],
[AS_IF([test "x$enable_lto" = "xyes"],
[CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto])],
[AC_MSG_RESULT([disabling -flto as requested])])],
[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")