Subject: bug#9708: aclocal -W error does not treat warnings as errors

From: Stefano Lattarini <[email-masked]>
Date: Mon, 10 Oct 2011 12:44:43 +0200

On Sunday 09 October 2011, Křištof Želechovski wrote:
> I would expect aclocal to fail and terminate the build script if warnings appear
> [1]; however, it does not happen:
> 
> == Steps to reproduce ==
> { cat >configure.ac <<'#>configure.ac' && aclocal -W error && echo $?; }
> AC_INIT([name],[0.0.1])
> AC_CANONICAL_TARGET
> AM_INIT_AUTOMAKE
> AC_COMPILE_IFELSE()
> AC_USE_SYSTEM_EXTENSIONS
> #>configure.ac
> 
> == Actual results ==
> configure.ac:26: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
> 0
> 
> == Expected results ==
> configure.ac:26: warning: AC_COMPILE_IFELSE was called before AC_USE_SYSTEM_EXTENSIONS
> 
> == Workaround ==
> { WARNINGS=error aclocal; }
> aclocal: autom4te failed with exit status: 1
> 
> == Remarks ==
> It seems that aclocal fails to pass -Werror to autom4te.
>
Hi Křištof, thanks for the report and the diagnosis.

But honestly, I'm not sure it would be a good idea to "fix" the current
aclocal behaviour.  In fact, aclocal should IMHO be concerned only with
warnings coming from the distinctive functions it performs (e.g., when
it detects an underquoted macro in an .m4 files it has scanned, or when
it finds a macro defined in acinclude.m4 that is not really used in
configure.ac); but aclocal should not be too picky about warnings coming
from other tools (i.e., it's good to pass them along, but not to choke
on them, even when `-Werror' is in use).  So, if one wants the autoconf
warnings to be treated as errors, one should pass the `-Werror' flag to
the autoconf invocation.

That said, a documentation patch clarifying the current behaviour of
aclocal and the rationale behind it might be nice.  I might give it a
try, but it's quite low-priority.  Anyway, patches welcome.

Regards,
  Stefano