diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-10 12:22:21 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-10 12:53:32 +0100 |
commit | 923c52ffbb79526ca711fa98b5e865d210d01941 (patch) | |
tree | a690d88b43310fc99e249fadf9f5fc1078045e01 /m4 | |
parent | a981c6c355f752a7866222d2a2629445b232d8c2 (diff) | |
download | NetworkManager-923c52ffbb79526ca711fa98b5e865d210d01941.tar.gz |
build: test for support of -flto compiler flag
... and prepend the $ld_gc_flags instead of appending to the $CFLAGS.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/compiler_options.m4 | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/m4/compiler_options.m4 b/m4/compiler_options.m4 index fa35b91681..5275281d71 100644 --- a/m4/compiler_options.m4 +++ b/m4/compiler_options.m4 @@ -128,9 +128,14 @@ fi AC_DEFUN([NM_LTO], [AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable Link Time Optimization for smaller size (default: no)])) if (test "${enable_lto}" = "yes"); then - CFLAGS="-flto $CFLAGS" + CC_CHECK_FLAG_APPEND([lto_flags], [CFLAGS], [-flto]) + if (test -n "${lto_flags}"); then + CFLAGS="-flto $CFLAGS" + else + AC_MSG_ERROR([Link Time Optimization -flto is not supported.]) + fi else - enable_lto='no' + enable_lto='no' fi ]) @@ -140,7 +145,7 @@ if (test "${enable_ld_gc}" != "no"); then CC_CHECK_FLAG_APPEND([ld_gc_flags], [CFLAGS], [-fdata-sections -ffunction-sections -Wl,--gc-sections]) if (test -n "${ld_gc_flags}"); then enable_ld_gc="yes" - CFLAGS="$CFLAGS $ld_gc_flags" + CFLAGS="$ld_gc_flags $CFLAGS" else if (test "${enable_ld_gc}" = "yes"); then AC_MSG_ERROR([Unused symbol eviction requested but not supported.]) |