Commit ff3a0f6c authored by Damien Fouilleul's avatar Damien Fouilleul

vlc-config: fixed optimizations by splitting CFLAGS_OPTIM into...

vlc-config: fixed optimizations by splitting CFLAGS_OPTIM into CFLAGS_OPTIM_SIZE and CFLAGS_OPTIM_SPEED, and only one of which is used depending on value --enable-optimize-memory, moreover CFLAGS_NOOPTIM is set to -O0 rather than -O2 whenever possible
parent f0fd5fd5
...@@ -1004,38 +1004,50 @@ AC_CACHE_CHECK([if \$CC accepts -Os], ...@@ -1004,38 +1004,50 @@ AC_CACHE_CHECK([if \$CC accepts -Os],
[ac_cv_c_os], [ac_cv_c_os],
[CFLAGS="${CFLAGS_save} -Os" [CFLAGS="${CFLAGS_save} -Os"
AC_TRY_COMPILE([],,ac_cv_c_os=yes, ac_cv_c_os=no)]) AC_TRY_COMPILE([],,ac_cv_c_os=yes, ac_cv_c_os=no)])
if test "${ac_cv_c_os}" != "no" -a "${host_cpu}" = "mipsel"; then if test "${ac_cv_c_os}" != "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -Os" CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -Os"
else
AC_CACHE_CHECK([if \$CC accepts -O],
[ac_cv_c_o],
[CFLAGS="${CFLAGS_save} -O"
AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
if test "${ac_cv_c_o}" != "no"; then
if test "${ac_cv_c_o3}" = "no"; then
CFLAGS_OPTIM_SIZE="${CFLAGS_OPTIM_SIZE} -O"
fi
fi
fi fi
AC_CACHE_CHECK([if \$CC accepts -O3], AC_CACHE_CHECK([if \$CC accepts -O3],
[ac_cv_c_o3], [ac_cv_c_o3],
[CFLAGS="${CFLAGS_save} -O3" [CFLAGS="${CFLAGS_save} -O3"
AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)]) AC_TRY_COMPILE([],,ac_cv_c_o3=yes, ac_cv_c_o3=no)])
if test "${ac_cv_c_o3}" != "no" -a "${host_cpu}" != "mipsel"; then if test "${ac_cv_c_o3}" != "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3" CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O3"
else
AC_CACHE_CHECK([if \$CC accepts -O2],
[ac_cv_c_o2],
[CFLAGS="${CFLAGS_save} -O2"
AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)])
if test "${ac_cv_c_o2}" != "no"; then
CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O2"
else
AC_CACHE_CHECK([if \$CC accepts -O],
[ac_cv_c_o],
[CFLAGS="${CFLAGS_save} -O"
AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
if test "${ac_cv_c_o}" != "no"; then
CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -O"
fi
fi
fi fi
AC_CACHE_CHECK([if \$CC accepts -O2], AC_CACHE_CHECK([if \$CC accepts -O0],
[ac_cv_c_o2], [ac_cv_c_o0],
[CFLAGS="${CFLAGS_save} -O2" [CFLAGS="${CFLAGS_save} -O0"
AC_TRY_COMPILE([],,ac_cv_c_o2=yes, ac_cv_c_o2=no)]) AC_TRY_COMPILE([],,ac_cv_c_o0=yes, ac_cv_c_o0=no)])
if test "${ac_cv_c_o2}" != "no" -a "${host_cpu}" != "mipsel"; then if test "${ac_cv_c_o0}" != "no"; then
if test "${ac_cv_c_o3}" = "no"; then CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O0"
CFLAGS_OPTIM="${CFLAGS_OPTIM} -O2"
fi
CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O2"
else
AC_CACHE_CHECK([if \$CC accepts -O],
[ac_cv_c_o],
[CFLAGS="${CFLAGS_save} -O"
AC_TRY_COMPILE([],,ac_cv_c_o=yes, ac_cv_c_o=no)])
if test "${ac_cv_c_o}" != "no" -a "${host_cpu}" != "mipsel"; then
if test "${ac_cv_c_o3}" = "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -O"
fi
CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O"
fi
fi fi
dnl Check for -ffast-math dnl Check for -ffast-math
...@@ -1044,7 +1056,7 @@ AC_CACHE_CHECK([if \$CC accepts -ffast-math], ...@@ -1044,7 +1056,7 @@ AC_CACHE_CHECK([if \$CC accepts -ffast-math],
[CFLAGS="${CFLAGS_save} -ffast-math" [CFLAGS="${CFLAGS_save} -ffast-math"
AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)]) AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
if test "${ac_cv_c_fast_math}" != "no"; then if test "${ac_cv_c_fast_math}" != "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math" CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -ffast-math"
fi fi
dnl Check for -funroll-loops dnl Check for -funroll-loops
...@@ -1056,7 +1068,7 @@ then ...@@ -1056,7 +1068,7 @@ then
[CFLAGS="${CFLAGS_save} -funroll-loops" [CFLAGS="${CFLAGS_save} -funroll-loops"
AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)]) AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
if test "${ac_cv_c_unroll_loops}" != "no"; then if test "${ac_cv_c_unroll_loops}" != "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -funroll-loops" CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -funroll-loops"
fi fi
fi fi
...@@ -1555,7 +1567,13 @@ dnl Enable/disable optimizations ...@@ -1555,7 +1567,13 @@ dnl Enable/disable optimizations
dnl dnl
AC_ARG_ENABLE(optimizations, AC_ARG_ENABLE(optimizations,
[ --disable-optimizations disable compiler optimizations (default enabled)]) [ --disable-optimizations disable compiler optimizations (default enabled)])
test "${enable_optimizations}" != "no" && enable_optimizations="yes" if test "${enable_optimizations}" != "no"; then
if test "${enable_optimize_memory}" = "yes"; then
enable_optimizations="size"
else
enable_optimizations="speed"
fi
fi
dnl dnl
dnl AltiVec acceleration dnl AltiVec acceleration
......
...@@ -88,7 +88,8 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [ ...@@ -88,7 +88,8 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
-e "s/@PLUGINS@/${PLUGINS}/" \ -e "s/@PLUGINS@/${PLUGINS}/" \
-e "s/@BUILTINS@/${BUILTINS}/" \ -e "s/@BUILTINS@/${BUILTINS}/" \
-e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \ -e "s/@CFLAGS_TUNING@/${CFLAGS_TUNING}/" \
-e "s/@CFLAGS_OPTIM@/${CFLAGS_OPTIM}/" \ -e "s/@CFLAGS_OPTIM_SIZE@/${CFLAGS_OPTIM_SIZE}/" \
-e "s/@CFLAGS_OPTIM_SPEED@/${CFLAGS_OPTIM_SPEED}/" \
-e "s/@CFLAGS_OPTIM_NODEBUG@/${CFLAGS_OPTIM_NODEBUG}/" \ -e "s/@CFLAGS_OPTIM_NODEBUG@/${CFLAGS_OPTIM_NODEBUG}/" \
-e "s/@CFLAGS_NOOPTIM@/${CFLAGS_NOOPTIM}/" \ -e "s/@CFLAGS_NOOPTIM@/${CFLAGS_NOOPTIM}/" \
> vlc-config.in > vlc-config.in
......
...@@ -21,7 +21,8 @@ objcflags="" ...@@ -21,7 +21,8 @@ objcflags=""
ldflags="" ldflags=""
cflags_tuning="@CFLAGS_TUNING@" cflags_tuning="@CFLAGS_TUNING@"
cflags_optim="@CFLAGS_OPTIM@" cflags_optim_size="@CFLAGS_OPTIM_SIZE@"
cflags_optim_speed="@CFLAGS_OPTIM_SPEED@"
cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@" cflags_optim_nodebug="@CFLAGS_OPTIM_NODEBUG@"
cflags_nooptim="@CFLAGS_NOOPTIM@" cflags_nooptim="@CFLAGS_NOOPTIM@"
...@@ -130,8 +131,13 @@ fi ...@@ -130,8 +131,13 @@ fi
if [ "${release}" = yes ]; then if [ "${release}" = yes ]; then
cppflags="${cppflags} -DHAVE_RELEASE" cppflags="${cppflags} -DHAVE_RELEASE"
fi fi
if [ "${optim}" = yes ]; then if [ "${optim}" = size ]; then
cppflags="${cppflags} ${cflags_optim} ${cflags_tuning}" cppflags="${cppflags} ${cflags_optim_size} ${cflags_tuning}"
if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
cppflags="${cppflags} ${cflags_optim_nodebug}"
fi
elif [ "${optim}" = speed ]; then
cppflags="${cppflags} ${cflags_optim_speed} ${cflags_tuning}"
if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then if [ "${debug}" != yes -a "${gprof}" != yes -a "${cprof}" != yes ]; then
cppflags="${cppflags} ${cflags_optim_nodebug}" cppflags="${cppflags} ${cflags_optim_nodebug}"
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment