Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to add a CFLAG, such as -std=gnu99, into an (Eclipse CDT) autotools project

I have a simple Autotools C project (not C++), whose skeleton was created for me by Eclipse CDT (Juno).

CFLAGs (by inspection) seem to be -g -O2.

I want all of the generated make files to also have -std=gnu99 appended to the CFLAGs, because I use for (int i = 0; i < MAX; i++) and similar.

I can obviously hack the Makefile, but this gets overwritten on ./configure.

Where is the correct place to add (or change) CFLAGs which are required by the code (as opposed to those CFLAGs which the user might want to change)?

P.S. I'd like to do this by editing a text file (such as Makefile.am or configure.ac), rather than clicking a box in Eclipse, if possible.

like image 269
fadedbee Avatar asked Jul 24 '12 15:07

fadedbee


1 Answers

Just run into the same problem.

Here is the solution, just add the CFLAGS at the end of the configure options:

enter image description here

If you want to do this by editing configure.ac, just add CFLAGS="$CFLAGS something" into configure.ac

like image 82
Šimon Tóth Avatar answered Sep 23 '22 12:09

Šimon Tóth