Commit 7160ce9f authored by Pierre d'Herbemont's avatar Pierre d'Herbemont

configure: Per module Werror flags.

This allow a little bit more flexibility and won't require the same level of code quality in configure tests (is that a plus?).
parent 1fb8c01a
...@@ -1004,7 +1004,7 @@ fi ...@@ -1004,7 +1004,7 @@ fi
CFLAGS="${CFLAGS_save}" CFLAGS="${CFLAGS_save}"
RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast cast-align write-strings missing-prototypes volatile-register-var error-implicit-function-declaration]) RDC_PROG_CC_WFLAGS([all extra sign-compare undef pointer-arith bad-function-cast cast-align write-strings missing-prototypes volatile-register-var error-implicit-function-declaration])
RDC_PROG_CC_FLAGS_IFELSE([-pipe]) RDC_PROG_CC_FLAGS([-pipe])
AC_ARG_ENABLE(warnings-as-error, AC_ARG_ENABLE(warnings-as-error,
AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default in debug)]),, [enable_warnings_as_error="$enable_debug"]) AS_HELP_STRING([--enable-warnings-as-error],[Treat acceptable warnings as error (default in debug)]),, [enable_warnings_as_error="$enable_debug"])
...@@ -1013,6 +1013,7 @@ AS_IF([test "${enable_warnings_as_error}" = "yes"], [ ...@@ -1013,6 +1013,7 @@ AS_IF([test "${enable_warnings_as_error}" = "yes"], [
missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \ missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \
bad-function-cast ignored]) bad-function-cast ignored])
]) ])
AC_SUBST(CFLAGS_WERROR)
dnl Check for various optimization flags dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -Os], AC_CACHE_CHECK([if \$CC accepts -Os],
......
...@@ -22,24 +22,24 @@ AC_DEFUN([RDC_PROG_CC_FLAGS_IFELSE], ...@@ -22,24 +22,24 @@ AC_DEFUN([RDC_PROG_CC_FLAGS_IFELSE],
]) ])
ac_res=`eval echo '${'$as_ac_var'}'` ac_res=`eval echo '${'$as_ac_var'}'`
AS_IF([test "${ac_res}" != "no"], [
CFLAGS="${CFLAGS_save} $1"
$2
], [
CFLAGS="${CFLAGS_save}" CFLAGS="${CFLAGS_save}"
$3 AS_IF([test "${ac_res}" != "no"], [$2], [$3])
]) ])
AC_DEFUN([RDC_PROG_CC_FLAGS],
[AC_LANG_ASSERT(C)
RDC_PROG_CC_FLAGS_IFELSE([$1], [CFLAGS="${CFLAGS} $1"])
]) ])
AC_DEFUN([RDC_PROG_CC_WERRORFLAGS], AC_DEFUN([RDC_PROG_CC_WERRORFLAGS],
[ for a in $1; do [ for a in $1; do
RDC_PROG_CC_FLAGS_IFELSE([-Werror=$a]) RDC_PROG_CC_FLAGS_IFELSE([-Werror=$a], [CFLAGS_WERROR="${CFLAGS_WERROR} -Werror=${a}"])
done done
]) ])
AC_DEFUN([RDC_PROG_CC_WFLAGS], AC_DEFUN([RDC_PROG_CC_WFLAGS],
[ for a in $1; do [ for a in $1; do
RDC_PROG_CC_FLAGS_IFELSE([-W$a]) RDC_PROG_CC_FLAGS([-W$a])
done done
]) ])
......
...@@ -58,6 +58,12 @@ AC_DEFUN([VLC_ADD_LIBS], [ ...@@ -58,6 +58,12 @@ AC_DEFUN([VLC_ADD_LIBS], [
done done
]) ])
AC_DEFUN([VLC_SET_CFLAGS_WERROR], [
for element in [$1]; do
eval "CFLAGS_WERROR_${element}="'"'"$2"''"'
done
])
dnl =========================================================================== dnl ===========================================================================
dnl Macros to save and restore default flags dnl Macros to save and restore default flags
...@@ -132,6 +138,9 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [ ...@@ -132,6 +138,9 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\"" echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\""
fi fi
if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
echo " CFLAGS_WERROR=\"`eval echo '$'CFLAGS_WERROR_${x}`\""
fi
echo " ;;" echo " ;;"
] done >> vlc-config.in ] done >> vlc-config.in
......
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