How to enable flags with a GCC-specific vending machine

I'm new to automake, but found my way through the docs and all that I like. However, I currently have CFLAGS = "- Wall -Werror" enabled. Although this works great for gcc, I assume that someone is going to create my code using a non-gcc compiler. What is the correct way to determine if GCC is in use and set only these flags for GCC?

Edit

The solution looks like this:

Edit 2

This macro can also be more useful than -Wall, since it does the same for several compilers: http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html

+4
source share
1 answer

You can check if each flag is supported with an Autoconf macro such as AX_CHECK_COMPILE_FLAG .

+3
source

All Articles