configure: [loongson] revert no-expensive-optimizations

Add gcc version check before add -fno-expensive-optimizations flag.
Only when gcc version is lower than 5.3.0, this flag is needed.
More bug info see:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67736
https://gcc.gnu.org/ml/gcc-patches/2012-05/msg00401.html

Signed-off-by: Shiyou Yin <yinshiyou-hf@loongson.cn>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Shiyou Yin 2018-08-24 17:22:12 +08:00 committed by Michael Niedermayer
parent ad2ac1e7dd
commit e13e52fd0d

15
configure vendored
View File

@ -4819,15 +4819,24 @@ elif enabled mips; then
disable mipsfpu disable mipsfpu
disable mipsdsp disable mipsdsp
disable mipsdspr2 disable mipsdspr2
# When gcc version less than 5.3.0, add -fno-expensive-optimizations flag.
if [ $cc == gcc ]; then
gcc_version=$(gcc -dumpversion)
if [ "$(echo "$gcc_version 5.3.0" | tr " " "\n" | sort -rV | head -n 1)" == "$gcc_version" ]; then
expensive_optimization_flag=""
else
expensive_optimization_flag="-fno-expensive-optimizations"
fi
fi
case $cpu in case $cpu in
loongson3*) loongson3*)
cpuflags="-march=loongson3a -mhard-float -fno-expensive-optimizations" cpuflags="-march=loongson3a -mhard-float $expensive_optimization_flag"
;; ;;
loongson2e) loongson2e)
cpuflags="-march=loongson2e -mhard-float -fno-expensive-optimizations" cpuflags="-march=loongson2e -mhard-float $expensive_optimization_flag"
;; ;;
loongson2f) loongson2f)
cpuflags="-march=loongson2f -mhard-float -fno-expensive-optimizations" cpuflags="-march=loongson2f -mhard-float $expensive_optimization_flag"
;; ;;
esac esac
;; ;;