diff --git a/configure.ac b/configure.ac index 3e9e1c0ae2c2..7bdea6f7333b 100644 --- a/configure.ac +++ b/configure.ac @@ -514,9 +514,13 @@ if test -n "$with_android_ndk"; then esac if test "$ENABLE_LTO" = TRUE; then - # -flto comes from com_GCC_degs.mk, too, but we need to make sure it gets passed as part of + # -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of # $CC and $CXX when building external libraries - ANDROIDCFLAGS="$ANDROIDCFLAGS -flto" + if test "$COM_IS_CLANG" = TRUE; then + ANDROIDCFLAGS="$ANDROIDCFLAGS -flto" + else + ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2" + fi fi # gdbserver can be in different locations