Q:

How to make autotools generated ./configure enforce availability of C11's _Generic?

I have an autotools project which requires a compiler which supports C11's _Generic feature.
Clang 2.3 and gcc 4.9 support this, but gcc 4.8.2 (supplied with Ubuntu 14.04LTS) doesn't.
(Confusingly gcc 4.8.2 supports --std=c11, but not the _Generic feature of that standard.)
Is there a macro for configure.ac to enforce the use of a _Generic compatible compiler?

A:

There is no built-in test for this, but I think you can easily do it using a AC_COMPILE_IFELSE.  The manual explains all the details, but basically you would give it a test program using _Generic as an argument, and then make the failure case call AC_MSG_ERROR.
In some cases, though, I think it is better simply not to check for language features that you plan to use unconditionally.  You can just use them and let compilation fail.

