On 11/20/11 1:49 PM, Simon Josefsson wrote:
>  Another approach is to add -Werror last (this is what Eric Blake
>  suggested on the autoconf mailing list a long time ago), e.g.:
>
>  AC_DEFUN([OVS_ENABLE_WERROR],
>     [AC_ARG_ENABLE(
>        [Werror],
>        [AC_HELP_STRING([--enable-Werror], [Add -Werror to CFLAGS])],
>        [], [enable_Werror=no])
>      AC_CONFIG_COMMANDS_PRE(
>        [if test "X$enable_Werror" = Xyes; then
>           CFLAGS="$CFLAGS -Werror"
>         fi])])
But does that really work?  Don't you risk affecting ./configure checks
that often are written in a way that triggers warnings, and with the
-Werror flag, leads to compilation errors.  If the only reason for the
compilation to fail was the -Werror flag, then that ./configure check
has the wrong result.  I guess it may depend on where in the ./configure
run the statement above is placed, but that seems fragile to me.
Hi Simon,

The key is that -Werror is added to CFLAGS within AC_CONFIG_COMMANDS_PRE, which means it occurs in configure just before config.status is created, in other words, all checks should already have been executed.

Peter

Reply via email to