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],
[ac_cv_c_os],
[CFLAGS="${CFLAGS_save} -Os"
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
CFLAGS_OPTIM="${CFLAGS_OPTIM} -Os"
if test "${ac_cv_c_os}" != "no"; then
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
AC_CACHE_CHECK([if \$CC accepts -O3],
[ac_cv_c_o3],
[CFLAGS="${CFLAGS_save} -O3"
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
CFLAGS_OPTIM="${CFLAGS_OPTIM} -O3"
if test "${ac_cv_c_o3}" != "no"; then
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
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" -a "${host_cpu}" != "mipsel"; then
if test "${ac_cv_c_o3}" = "no"; then
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
AC_CACHE_CHECK([if \$CC accepts -O0],
[ac_cv_c_o0],
[CFLAGS="${CFLAGS_save} -O0"
AC_TRY_COMPILE([],,ac_cv_c_o0=yes, ac_cv_c_o0=no)])
if test "${ac_cv_c_o0}" != "no"; then
CFLAGS_NOOPTIM="${CFLAGS_NOOPTIM} -O0"
fi
dnl Check for -ffast-math
......@@ -1044,7 +1056,7 @@ AC_CACHE_CHECK([if \$CC accepts -ffast-math],
[CFLAGS="${CFLAGS_save} -ffast-math"
AC_TRY_COMPILE([],,ac_cv_c_fast_math=yes, ac_cv_c_fast_math=no)])
if test "${ac_cv_c_fast_math}" != "no"; then
CFLAGS_OPTIM="${CFLAGS_OPTIM} -ffast-math"
CFLAGS_OPTIM_SPEED="${CFLAGS_OPTIM_SPEED} -ffast-math"
fi
dnl Check for -funroll-loops
......@@ -1056,7 +1068,7 @@ then
[CFLAGS="${CFLAGS_save} -funroll-loops"
AC_TRY_COMPILE([],,ac_cv_c_unroll_loops=yes, ac_cv_c_unroll_loops=no)])
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
......@@ -1555,7 +1567,13 @@ dnl Enable/disable optimizations
dnl
AC_ARG_ENABLE(optimizations,
[ --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 AltiVec acceleration
......
......@@ -88,7 +88,8 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
-e "s/@PLUGINS@/${PLUGINS}/" \
-e "s/@BUILTINS@/${BUILTINS}/" \
-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_NOOPTIM@/${CFLAGS_NOOPTIM}/" \
> vlc-config.in
......
......@@ -21,7 +21,8 @@ objcflags=""
ldflags=""
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_nooptim="@CFLAGS_NOOPTIM@"
......@@ -130,8 +131,13 @@ fi
if [ "${release}" = yes ]; then
cppflags="${cppflags} -DHAVE_RELEASE"
fi
if [ "${optim}" = yes ]; then
cppflags="${cppflags} ${cflags_optim} ${cflags_tuning}"
if [ "${optim}" = size ]; then
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
cppflags="${cppflags} ${cflags_optim_nodebug}"
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