]> git.wh0rd.org Git - elf2flt.git/commitdiff
configure: build with -Werror by default
authorMike Frysinger <vapier@gentoo.org>
Fri, 18 Dec 2015 05:07:21 +0000 (00:07 -0500)
committerMike Frysinger <vapier@gentoo.org>
Fri, 18 Dec 2015 05:07:21 +0000 (00:07 -0500)
People can pass --disable-werror to turn this off.  But this will help
keep the main development builds clean with new code coming in.

configure
configure.ac

index bb31d537418fc8c6f3aa21f63e113b1275413bae..70bc82a81e40680138b17b69360a0dd46b772ad6 100755 (executable)
--- a/configure
+++ b/configure
@@ -705,6 +705,7 @@ with_binutils_include_dir
 with_binutils_ldscript_dir
 with_binutils_build_dir
 enable_ld_elf2flt_binary
+enable_werror
 enable_got_check
 enable_emit_relocs
 enable_emit_ctor_dtor
@@ -1333,6 +1334,7 @@ Optional Features:
   --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
   --disable-ld-elf2flt-binary
                           use ld-elf2flt shell script
+  --disable-werror        do not build with -Werror
   --disable-got-check     disable check for GOT (needed on H8)
   --disable-emit-relocs   don't use the --emit-relocs (-q) linker option
   --enable-emit-ctor-dtor manually create ctor/dtor list
@@ -2233,6 +2235,16 @@ var_yn_to_10() {
        fi
 }
 
+# Check whether --enable-werror was given.
+if test "${enable_werror+set}" = set; then :
+  enableval=$enable_werror;  werror=$enableval
+else
+   werror=yes
+
+fi
+
+var_yn_to_10 werror
+
 # Check whether --enable-got-check was given.
 if test "${enable_got_check+set}" = set; then :
   enableval=$enable_got_check;  got_check=$enableval
@@ -4258,7 +4270,12 @@ fi
 done
 
 
-test "$GCC" = yes && CFLAGS="-Wall $CFLAGS"
+if test "$GCC" = yes ; then
+       CFLAGS="-Wall $CFLAGS"
+       if test "$werror" = 1 ; then
+               CFLAGS="-Werror -Wno-error=unused-label $CFLAGS"
+       fi
+fi
 
 
 
index 951eb32407b9cf0db7791a71d398ca934befda91..4e7df5a6ce5a8fb8e0ac0afbd1dda9aab8aa1742 100644 (file)
@@ -58,6 +58,13 @@ var_yn_to_10() {
        fi
 }
 
+AC_ARG_ENABLE(werror,
+       AS_HELP_STRING([--disable-werror], [do not build with -Werror]),
+       [ werror=$enableval ],
+       [ werror=yes ]
+)
+var_yn_to_10 werror
+
 AC_ARG_ENABLE(got-check,
        AS_HELP_STRING([--disable-got-check], [disable check for GOT (needed on H8)]),
        [ got_check=$enableval ],
@@ -203,7 +210,12 @@ AC_CHECK_FUNCS([ \
        strsignal \
 ])
 
-test "$GCC" = yes && CFLAGS="-Wall $CFLAGS"
+if test "$GCC" = yes ; then
+       CFLAGS="-Wall $CFLAGS"
+       if test "$werror" = 1 ; then
+               CFLAGS="-Werror -Wno-error=unused-label $CFLAGS"
+       fi
+fi
 
 dnl Subsitute values
 AC_SUBST(target)