diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-04-01 18:53:43 +0000 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2008-04-01 18:53:43 +0000 |
commit | fbf81d4f5d46e2a5212ccd172df19598508fa4fd (patch) | |
tree | 882289017724a39af80afb32d3ad191f8d726f2a /m4 | |
parent | ac383bb65867644578f926e9136248a0dabb334f (diff) |
Don't enable linker optimizations unless -Wl,-O1 actually works (part of fd.o #15026)
Diffstat (limited to 'm4')
-rw-r--r-- | m4/linker.m4 | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/m4/linker.m4 b/m4/linker.m4 index 8093cb88e..e6a97cfff 100644 --- a/m4/linker.m4 +++ b/m4/linker.m4 @@ -26,13 +26,24 @@ # -------------------- # Add configure option to disable linker optimisations. AC_DEFUN([LINKER_OPTIMISATIONS], -[AC_ARG_ENABLE(linker-optimisations, +[ +AC_MSG_CHECKING([whether linker supports -Wl,-O1]) +save_LDFLAGS="$LDFLAGS" +LDFLAGS="$LDFLAGS -Wl,-O1" +AC_TRY_LINK([], [], [can_use_linker_opt=yes], + [can_use_linker_opt=no]) +LDFLAGS="$save_LDFLAGS" +AC_MSG_RESULT([$can_use_linker_opt]) + +if test "x$can_use_linker_opt" = "xno"; then + LDFLAGS="$save_LDFLAGS" +fi + +AC_ARG_ENABLE(linker-optimisations, AS_HELP_STRING([--disable-linker-optimisations], [Disable linker optimisations]), [if test "x$enable_linker_optimisations" = "xno"; then [LDFLAGS=`echo "$LDFLAGS" | sed -e "s/ -Wl,-O[0-9]*\b//g"`] -else - [LDFLAGS="$LDFLAGS -Wl,-O1"] fi], [LDFLAGS="$LDFLAGS -Wl,-O1"])dnl ])# LINKER_OPTIMISATIONS |