-
-# ------------------------------------------------------------------------------
-# On some distributions -flto, even if available, leads to linking errors.
-# We therefore make it optional
-have_lto=no
-AC_ARG_ENABLE([lto],
- [AS_HELP_STRING([--disable-lto], [Disable link time optimization (default: test)])])
-
-AS_IF([test "x$enable_lto" != "xno"], [
- AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
- [have_lto=yes],
- [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
- AS_IF([test "$have_lto" != "no"],
- [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto])]
- )
- AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")
-])
+AC_ARG_ENABLE([lto], [AS_HELP_STRING([--disable-lto], [disable -flto])],
+ [], [enable_lto=yes])
+AS_CASE([$CFLAGS], [*-O[[12345sz\ ]]*],
+ [AS_IF([test "x$enable_lto" = "xyes"],
+ [CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [-flto])],
+ [AC_MSG_RESULT([disabling -flto as requested])])],
+ [AC_MSG_RESULT([skipping -flto, optimization not enabled])])
+AC_SUBST([OUR_CFLAGS], "$with_cflags $sanitizer_cflags")