I have a simple Autotools C project (not C++).
CFLAGs (by inspection) seem to be -g -O2
.
I want all of the generated make files to also have
autoconf has a macro for this:
Just put:
AC_PROG_CC_STDC
after your AC_PROG_CC
and everything will be right.
Especially when you use other compilers that do not have -std=gnu99
but operate in C99 mode by default (or have a different option hpcc's -AC99
springs to mind).
I would NOT use CFLAGS
for that kind of thing.
From the docs:
-- Macro: AC_PROG_CC_STDC If the C compiler cannot compile ISO Standard C (currently C99), try to add an option to output variable `CC' to make it work. If the compiler does not support C99, fall back to supporting ANSI C89 (ISO C90). After calling this macro you can check whether the C compiler has been set to accept Standard C; if not, the shell variable `ac_cv_prog_cc_stdc' is set to `no'.