[vlc-devel] commit: configure: Per module Werror flags. (Pierre d'Herbemont )
git version control
git at videolan.org
Fri Aug 21 17:27:33 CEST 2009
vlc | branch: master | Pierre d'Herbemont <pdherbemont at free.fr> | Fri Aug 21 17:25:48 2009 +0200| [7160ce9f6ef3ef6d5afd3234e77611c01e90e1c2] | committer: 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?).
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7160ce9f6ef3ef6d5afd3234e77611c01e90e1c2
---
configure.ac | 3 ++-
m4/flags.m4 | 18 +++++++++---------
m4/vlc.m4 | 9 +++++++++
3 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index b2364da..7bb2b5d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1004,7 +1004,7 @@ fi
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_FLAGS_IFELSE([-pipe])
+RDC_PROG_CC_FLAGS([-pipe])
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"])
@@ -1013,6 +1013,7 @@ AS_IF([test "${enable_warnings_as_error}" = "yes"], [
missing-braces nonnull parentheses uninitialized address enum-compare undef comment switch \
bad-function-cast ignored])
])
+AC_SUBST(CFLAGS_WERROR)
dnl Check for various optimization flags
AC_CACHE_CHECK([if \$CC accepts -Os],
diff --git a/m4/flags.m4 b/m4/flags.m4
index 326a909..2741979 100644
--- a/m4/flags.m4
+++ b/m4/flags.m4
@@ -22,24 +22,24 @@ AC_DEFUN([RDC_PROG_CC_FLAGS_IFELSE],
])
ac_res=`eval echo '${'$as_ac_var'}'`
- AS_IF([test "${ac_res}" != "no"], [
- CFLAGS="${CFLAGS_save} $1"
- $2
- ], [
- CFLAGS="${CFLAGS_save}"
- $3
- ])
+ CFLAGS="${CFLAGS_save}"
+ 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],
[ 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
])
AC_DEFUN([RDC_PROG_CC_WFLAGS],
[ for a in $1; do
- RDC_PROG_CC_FLAGS_IFELSE([-W$a])
+ RDC_PROG_CC_FLAGS([-W$a])
done
])
diff --git a/m4/vlc.m4 b/m4/vlc.m4
index 6a4f241..130e47a 100644
--- a/m4/vlc.m4
+++ b/m4/vlc.m4
@@ -58,6 +58,12 @@ AC_DEFUN([VLC_ADD_LIBS], [
done
])
+AC_DEFUN([VLC_SET_CFLAGS_WERROR], [
+ for element in [$1]; do
+ eval "CFLAGS_WERROR_${element}="'"'"$2"''"'
+ done
+])
+
dnl ===========================================================================
dnl Macros to save and restore default flags
@@ -132,6 +138,9 @@ AC_DEFUN([VLC_OUTPUT_VLC_CONFIG_IN], [
if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
echo " libs=\"\${libs} `eval echo '$'LIBS_${x}`\""
fi
+ if test "`eval echo @'$'LIBS_${x}@`" != "@@"; then
+ echo " CFLAGS_WERROR=\"`eval echo '$'CFLAGS_WERROR_${x}`\""
+ fi
echo " ;;"
] done >> vlc-config.in
More information about the vlc-devel
mailing list