[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CHECK_FUNCS and gcc with -Werror

From: Steffen Dettmer
Subject: Re: AC_CHECK_FUNCS and gcc with -Werror
Date: Thu, 4 Mar 2010 00:27:12 +0100

On Wed, Mar 3, 2010 at 3:59 PM, Eric Blake <address@hidden> wrote:
>> I'm afraid again I just fail to see the obvious and it is very
>> easy to do?
> Yes.  Here's how m4 does it.  It uses the gl_WARN_ADD macro from the
> gnulib module manywarnings; but if you choose not to use gnulib, it is a
> simple enough macro that you can probably just inline it directly into

(ohh and this piece of M4-language-magic you call `very easy'...
will I ever be able to understand a bit of it uhh-ohh...)

> # ------------------------------------------------
> # Adds parameter to WARN_CFLAGS if the compiler supports it.  For example,
> # gl_WARN_ADD([-Wparentheses]).

(If I understand correctly, this macro checks if the compiler
still runs when the flag is given.)

> Then in, you give the user the option to request extra
> compiler flags, and create an AC_SUBST variable containing the result of
> the supported flags:
> AC_ARG_ENABLE([gcc-warnings],

ahh, you already wrote but I just notice now, it is gcc-option.
So instead of --enable-errors we could use --enable-gcc-errors
and --enable-cl-errors.

> Finally, in, you use those flags.  That way, CFLAGS was
> unchanged during configure (except temporarily, during gl_WARN_ADD, when
> sniffing whether the flag works), but make gets the benefit of the flag:

ahh ok this way.
Before I change my 352's:
- Can this do harm (e.g. in makefiles for packages without C
  sources or so)?
- Can I simply append `AM_CFLAGS += $(WERROR_CFLAGS)' to each and be done?
- should I better use something like `-include warnings.mak' or
  alike to be more flexible in case I'll need it later?

- Alternatively, by accident, ts there some way to tell configure
  something like: right just before writing config.status, set
  As Peter suggests?
- Instead of changing 352's, should I change 42
  configure.{in,ac} to have a line like
  right before AC_OUTPUT? Wouldn't this work, too? But as far as
  I know the order of macros/statements in does not
  mean that the actions are really executed in the order they
  Would this be an automatic way of what Peter suggests?

> > We now have in (or actually an included .m4
> > file) `CFLAGS="$CFLAGS -Werror";'
> That's where you are going wrong.  The recommended approach is
> to modify CFLAGS in the Makefile, using an AC_SUBST, rather
> than hard-coding the modification into configure.

ohh I though configure should configure the compiler flags?

We do not want that developers have to know about compiler flags
(i.e. they should not need to run make CFLAGS=longListOfStrangeThings),
especially when they cross-compile just to check for warnings
with compilers for platforms they don't use.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]