From: Felipe S. <fsa...@gm...> - 2013-11-25 13:30:19
|
On Mon, Nov 25, 2013 at 10:09 AM, Stephen Sinclair <rad...@gm...> wrote: > On Mon, Nov 25, 2013 at 2:01 PM, Felipe Sateler <fsa...@gm...> wrote: >> I hit one snag: the configure script munges the CFLAGS to remove >> -Werror. However, -Werror can take a parameter (eg, >> -Werror=format-security), meaning you end up with an invalid line like >> `gcc =format-security conftest.c`. >> >> I'm not sure configure should munge the CFLAGS, nor why would it be >> necessary (do some configure tests contain invalid code?). Removing >> the munging I can build and make test ends successfully > > > Okay, thanks. Believe me I hated adding code to mess with the flags, > but in fact if you pass -Werror, the configure script fails since some > tests, in particular AC_CHECK_FUNC, do indeed produce warnings. Ah, yes, because the function is possibly undeclared. > > I looked up how to deal with this and the recommendation seemed to > generally be to ensure -Werror was removed from CFLAGS before any > tests. I would think that adding it back is a mistake rather than > just recovering the old CFLAGS variable, but after some tests, new > flags may be added if I understand correctly. (Though now that I > think about it, maybe only LIBS would be modified by AC_CHECK_FUNC) > > I admit I didn't realize Werror could take arguments. I'll see if I > this can be dealt with better, thanks for finding the problem. Other options to consider: 1. Emptying up CFLAGS before configure and re set it afterwards. The disadvantage is that someone may have put needed -I or other flags here (although they should be in CPPFLAGS). 2. Adding -Wno-error=<whatever>. This is probably not very future-proof, as new warnings get added. 3. Don't touch CFLAGS, leave the developer to wonder what happened when the tests break after adding -Werror. 4. Print a warning when -Werror is detected, and then error out explicitly. -- Saludos, Felipe Sateler |