daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
803fb7
From 2d5ee8de927f69784d8380c24ca5505b3f6e7672 Mon Sep 17 00:00:00 2001
803fb7
From: systemd team <systemd-maint@redhat.com>
803fb7
Date: Tue, 14 Apr 2015 15:00:06 +0200
803fb7
Subject: [PATCH] build-sys: add configure option to disableLTO/gold
803fb7
803fb7
---
803fb7
 configure.ac | 15 ++++++++++-----
803fb7
 1 file changed, 10 insertions(+), 5 deletions(-)
803fb7
803fb7
diff --git a/configure.ac b/configure.ac
803fb7
index 081ed0f6e..9103f9b92 100644
803fb7
--- a/configure.ac
803fb7
+++ b/configure.ac
803fb7
@@ -208,10 +208,15 @@ AS_CASE([$CC], [*clang*],
803fb7
                -Wno-gnu-variable-sized-type-not-at-end \
803fb7
         ])])
803fb7
 
803fb7
-AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
803fb7
-        [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
803fb7
-               -flto -ffat-lto-objects])],
803fb7
-        [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
803fb7
+AC_ARG_ENABLE([lto], AS_HELP_STRING([--disable-lto], [Disable Link time optimization]))
803fb7
+AS_IF([test "x$enable_lto" != "xno"], [
803fb7
+AS_CASE([$CFLAGS], [*-O[[12345\ ]]*], [
803fb7
+         CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto -ffat-lto-objects])
803fb7
+         CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS],[-Wl,-fuse-ld=gold])
803fb7
+         ],
803fb7
+[AC_MSG_RESULT([skipping -flto, optimization not enabled])])
803fb7
+])
803fb7
+
803fb7
 AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
803fb7
 
803fb7
 AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
803fb7
@@ -227,7 +232,7 @@ CC_CHECK_FLAGS_APPEND([with_ldflags], [LDFLAGS], [\
803fb7
         -Wl,-z,relro \
803fb7
         -Wl,-z,now \
803fb7
         -pie \
803fb7
-        -Wl,-fuse-ld=gold])
803fb7
+        ])
803fb7
 AC_SUBST([OUR_LDFLAGS], "$with_ldflags $sanitizer_ldflags")
803fb7
 
803fb7
 AC_CHECK_SIZEOF(pid_t)