summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <meissner@suse.de>2012-04-14 14:47:02 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-04-14 14:48:32 +0100
commitd486ea30f1a58640a1178de74f705a73845b1cda (patch)
treeab04753a57f003768779c653ab2588f18f7c6662
parent25abe582982caeb07d1e0af4acca53bb110a33bf (diff)
configure: Conditionally include -flto
As some systems fail to create working binaries with when linked with lto, perform a check during configure. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=39114
-rw-r--r--build/configure.ac.warnings13
1 files changed, 12 insertions, 1 deletions
diff --git a/build/configure.ac.warnings b/build/configure.ac.warnings
index 3b2c6f31f..9b9c742a2 100644
--- a/build/configure.ac.warnings
+++ b/build/configure.ac.warnings
@@ -32,7 +32,18 @@ MAYBE_WARN="$MAYBE_WARN -erroff=E_ENUM_TYPE_MISMATCH_ARG \
dnl We also abuse the warning-flag facility to enable other compiler
dnl options. Namely, the following:
-MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common -flto"
+
+dnl -flto working really needs a test link, not just a compile
+
+safe_MAYBE_WARN="$MAYBE_WARN"
+MAYBE_WARN="$MAYBE_WARN -flto"
+AC_TRY_LINK([],[
+ int main(int argc, char **argv) { return 0; }
+],[],[
+ MAYBE_WARN="$safe_MAYBE_WARN"
+])
+
+MAYBE_WARN="$MAYBE_WARN -fno-strict-aliasing -fno-common"
dnl Also to turn various gcc/glibc-specific preprocessor checks
MAYBE_WARN="$MAYBE_WARN -Wp,-D_FORTIFY_SOURCE=2"