]> git.sesse.net Git - vlc/commitdiff
configure: Per module Werror flags.
authorPierre d'Herbemont <pdherbemont@free.fr>
Fri, 21 Aug 2009 15:25:48 +0000 (17:25 +0200)
committerPierre d'Herbemont <pdherbemont@free.fr>
Fri, 21 Aug 2009 15:25:48 +0000 (17:25 +0200)
This allow a little bit more flexibility and won't require the same level of code quality in configure tests (is that a plus?).

configure.ac
m4/flags.m4
m4/vlc.m4

index b2364dababd100659a1bfaeea7e50f3cb1bbfa16..7bb2b5dafe17f2628899d38a9e0d9de983fc8442 100644 (file)
@@ -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],
index 326a90933aab75fa02ce76f8c25ee2ef00ca2bd9..2741979bb04ca0f99aaa60aabdf5ae612b152c63 100644 (file)
@@ -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
 ])
 
index 6a4f241a6ea874e676c6d9a114a06e17f59c534b..130e47a5c4aafdadbd2358ef2c2e6780219edef7 100644 (file)
--- 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