0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

configure: Compile with -O2 instead of -O4

-O4 (which GCC interprets the same as -O3) gives no consistent
performance advantage, being significantly worse than -O2 sometimes.
-O2 gives faster compilation and smaller binary.
This commit is contained in:
Uoti Urpala 2009-07-22 20:38:45 +03:00
parent 9ce0838ffd
commit 6fbcf16cfb

8
configure vendored
View File

@ -2414,8 +2414,8 @@ cat > $TMPC << EOF
__attribute__((noinline)) static int foo3(int i1, int i2, int i3) { return i3; }
int main(void) { return foo3(1,2,3) == 3 ? 0 : 1; }
EOF
cc_check -O4 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
test -z "$cflags_stackrealign" && cc_check -O4 -mstackrealign -fno-unit-at-a-time \
cc_check -O2 -mstackrealign && tmp_run && cflags_stackrealign=-mstackrealign
test -z "$cflags_stackrealign" && cc_check -O2 -mstackrealign -fno-unit-at-a-time \
&& tmp_run && cflags_stackrealign="-mstackrealign -fno-unit-at-a-time"
test -n "$cflags_stackrealign" && echores "yes" || echores "no"
fi # if darwin && test "$cc_vendor" = "gnu" ; then
@ -2432,7 +2432,7 @@ elif test -z "$CFLAGS" ; then
elif test "$cc_vendor" != "gnu" ; then
CFLAGS="-O2 $_march $_mcpu $_pipe"
else
CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O4 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
CFLAGS="-Wall -Wno-switch -Wpointer-arith -Wredundant-decls -O2 $_march $_mcpu $_pipe -ffast-math -fomit-frame-pointer"
extra_ldflags="$extra_ldflags -ffast-math"
fi
else
@ -6572,7 +6572,7 @@ int main(void) { unsigned long x, y; faacEncOpen(48000, 2, &x, &y); return 0; }
EOF
_faac=no
for _ld_faac in "-lfaac" "-lfaac -lmp4v2 -lstdc++" ; do
cc_check -O4 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
cc_check -O2 $_ld_faac $_ld_lm && libs_mencoder="$libs_mencoder $_ld_faac" && _faac=yes && break
done
fi
if test "$_faac" = yes ; then