autoconf
[Top][All Lists]
Advanced

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

Re: AC_CHECK_FUNCS and gcc with -Werror


From: Ralf Corsepius
Subject: Re: AC_CHECK_FUNCS and gcc with -Werror
Date: Wed, 03 Mar 2010 15:52:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Thunderbird/3.0.3

On 03/03/2010 03:27 PM, Steffen Dettmer wrote:
On Wed, Mar 3, 2010 at 2:44 PM, Eric Blake<address@hidden>  wrote:
According to Steffen Dettmer on 3/3/2010 6:33 AM:
Do I understand correctly that it is generally adviced to not use
the option -Werror?

Not quite.  The advice is to not mix -Werror and configure.

ahh ok, this is fine!
There is no need to have -Werror during configure.
So it seems again we just do the things wrongly :)
But how to do it correctly?

Post-configure, you can use -Werror to your heart's content, and I do it
all the time in packages that I maintain.

I'm not sure if I get this...
How do I use -Werror or -WX post-configure correctly?

Several ways:

a) Override CFLAGS at make time:
./configure CFLAGS="<cflags>"
make CFLAGS="<cflags -Werror"

This is what I would do - It doesn't clutter the autotool-files with GCC-proprietary -Werror handling and is appropriate for development purposes.


b) Implement it as a conditional AC_SUBST, i.e.
something similar to

AC_ARG_ENABLE([werror],
...
/* if gcc */
CFLAGS_WERROR="-Werror"
...
/* if other compiler */
CFLAGS_WERROR="<whatever>"
...
])
AC_SUBST([CFLAGS_WERROR])


accompanied by something similar to this in your Makefile.in's
CFLAGS = @CFLAGS@ @CFLAGS_WERROR@
rsp. (in case of using automake)
AM_CFLAGS = @CFLAGS_WERROR@

I would not want to use this approach.

Ralf




reply via email to

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