On 7/14/22 03:03, Tobias Brunner wrote:
how to handle -Werror when we explicitly want to fail our automated builds based on warnings without affecting the tests in configure. Is there a proper way to do this with Autoconf?
The way Gnulib-using programs do it, is to not use -Werror when running ./configure. Instead, use it when running 'make'. This makes sense, as ./configure does all sorts of low-level stuff that C compilers might complain about incorrectly.
Commonly there's a 'make' macro WARN_CFLAGS that contains warning options like -Wall, and WERROR_CFLAGS that contains just -Werror, and then AM_CFLAGS (or CFLAGS or whatever) contains $(WARN_CFLAGS) $(WERROR_CFLAGS). This lets the builder type 'make WERROR_CFLAGS=' to ignore warning failures, if that's what's wanted.
See GNU Grep for an example of this.