autoconf for compiler warnings

Ben Elliston bje at
Mon Dec 9 10:44:12 EST 2002


>>>>> "Brad" == Brad Hards <bhards=bzGI/hKkdgQnC9Muvcwxkw at> writes:

  Brad> One thing I can't seem to find though: how to test compiler
  Brad> behaviour for warning flags. Basically, if I have gcc, I want
  Brad> to set CFLAGS="${CFLAGS} -Wall -W", and on other compilers,
  Brad> I'd like the closest warning equivalent.

  Brad> Any ideas?

There is no existing support for doing this, except that most people
enable these warnings if they know they have gcc, otherwise do
nothing.  You might like to handle specific $CC values in a switch
(like `icc', `gcc', `lcc'), but otherwise, it's going to be hard to
read the compiler's mind.  When it comes to warnings, uniformity in
command line options goes out the window.

  Brad> BTW: Anyone know of a website that has an autoconf "cookbook"
  Brad> collection?

The official repository for macros is:

Cheers, Ben

More information about the linux mailing list