Question

Is it possible to use both command line parameters to the configure script, ala:

../configure CXXFLAGS=-O0 -g -foo -bar -bat

while simultaneously keeping any options that are passed to AM_INIT_AUTOMAKE in the configure.ac file? e.g.:

AM_INIT_AUTOMAKE([-Wall -Werror])

My desired result is that ALL of the above flags are passed along, e.g.:

-O0 -g -foo -bar -bat -Wall -Werror

It appears that specifying CXXFLAGS on the command line either ingores or overwrites what is passed into AM_INIT_AUTOMAKE. If anyone knows of a way to do the union of the two sets, that would be extremely helpful. Thx!

Was it helpful?

Solution

The -W warning categories options have nothing to do with C[XX]FLAGS. These are command line arguments used when invoking automake.

Conversely, the AM_INIT_AUTOMAKE options like -Wall don't affect the compiler flags. It's just the decision to use these switch names that is resulting in the confusion. They have a similar meaning, e.g., -Werror will treat automake warnings as errors, but are totally unrelated.

In short, you have to pass -Wall, etc., in C[XX]FLAGS to influence the compiler. And add -Wall to AM_INIT_AUTOMAKE to enable all warning categories when automake is invoked.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top