dcavalca / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone
Blob Blame History Raw
From 2d5ee8de927f69784d8380c24ca5505b3f6e7672 Mon Sep 17 00:00:00 2001
From: systemd team <systemd-maint@redhat.com>
Date: Tue, 14 Apr 2015 15:00:06 +0200
Subject: [PATCH] build-sys: add configure option to disableLTO/gold

---
 configure.ac | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/configure.ac b/configure.ac
index 081ed0f6eb..9103f9b923 100644
--- a/configure.ac
+++ b/configure.ac
@@ -208,10 +208,15 @@ AS_CASE([$CC], [*clang*],
                -Wno-gnu-variable-sized-type-not-at-end \
         ])])
 
-AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
-        [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
-               -flto -ffat-lto-objects])],
-        [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+AC_ARG_ENABLE([lto], AS_HELP_STRING([--disable-lto], [Disable Link time optimization]))
+AS_IF([test "x$enable_lto" != "xno"], [
+AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
+         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto -ffat-lto-objects])
+         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS],[-Wl,-fuse-ld=gold])
+         ],
+[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+])
+
 AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
 
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
@@ -227,7 +232,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
         -Wl,-z,relro \
         -Wl,-z,now \
         -pie \
-        -Wl,-fuse-ld=gold])
+        ])
 AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
 
 AC_CHECK_SIZEOF(pid_t)