[petsc-dev] CFLAGS and COPTFLAGS

Barry Smith bsmith at mcs.anl.gov
Fri Jan 17 17:57:58 CST 2014


On Jan 17, 2014, at 5:46 PM, Jed Brown <jed at jedbrown.org> wrote:

> Barry Smith <bsmith at mcs.anl.gov> writes:
> 
>>  I do not understand the context of this email at all.
>> 
>>  Are you referring to putting CFLAGS=-O3 inside a ./configure option?
>>  If so I see help.addArgument('Compilers', '-CFLAGS=<string>',
>>  nargs.Arg(None, None, 'Specify the C compiler options’))
> 
> If you configure with CFLAGS=-O3 --with-debugging=0, configure will test
> the -O flag and ultimately use -O3 -O.  The latter takes precedence, so
> the -O3 is effectively ignored.  To replace the optimization flag, one
> is (currently) supposed to use COPTFLAGS=-O3 --with-debugging=0.  This
> is surprising because COPTFLAGS is not a widespread convention.

   The problem is that CFLAGS can have all kind of flags having nothing to do with optimization. Could we do the following?

   Look through any provided CFLAGS (FFLAGS, CXXFLAGS) if we detect something that looks like optimization then act as if COPTFLAGS was set and do not set our own optimization default flag? We can also keep support for the COPTFLAGS stuff

   We can look for -O%d , are there other things to look for?  This seems easy enough to add.

   Barry

Request-assigned: Satish,Jed Look through any provided CFLAGS  to turn off default optimization from being set





More information about the petsc-dev mailing list