How do I remove -Werror from autotools-generated makefiles?

2k Views Asked by At

I am compiling a large library which uses the autotools build process. There are many makefiles. Each of them are getting CFLAGS = .... -Werror.

When I attempt to compile there are some minor warnings which kill the build on my setup.

I would like to try building despite the warnings so I need to take the -Werror out of all the makefiles. Is there a way to prevent autotools from putting in -Werror in all these makefiles?

3

There are 3 best solutions below

1
On BEST ANSWER

I poked around in configure.ac and found this:

AC_ARG_ENABLE([werror],
  AS_HELP_STRING([--disable-werror], [Do not treat warnings as errors]),
  [gcc_werror=$enableval], [gcc_werror=$gcc_warnings])

So I ran configure like this:

./configure --disable-werror

It worked like a charm. No more -Werror flags in my makefile. Thanks for your comment Till!

1
On

For autotools based project you may need to pass:

./autogen.sh --disable-Werror

Observe the upper-case W in Werror.

0
On

My sed way, after Makefile created

find . -name Makefile -exec sed -i s'/-Werror//g' {} \;

In Mac replace sed with gsed