4
votes

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
Check configure.ac - it might contain something like AM_INIT_AUTOMAKE([-Werror]). Do not edit the Makefile/s as those are generated. - Till

3 Answers

3
votes

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
votes

My sed way, after Makefile created

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

In Mac replace sed with gsed

0
votes

For autotools based project you may need to pass:

./autogen.sh --disable-Werror

Observe the upper-case W in Werror.