Can someone review the attached patch? I don't see a reason to maintain MPICH2_EXTRA_CFLAGS separately. A lot of autoconf and confdb macros anyway rely on having the flags set in CFLAGS. So, instead of adding these flags to MPICH2_EXTRA_CFLAGS and then adding them to CFLAGS every time we do a configure test, we should just add them to CFLAGS. I know that Anthony did this to avoid corrupting the precious variables, but autoconf/confdb seem to expect all the flags in CFLAGS and friends anyway. So, we ended up adding hacks to append these to CFLAGS each time. FWIW, all other projects seem to be adding stuff in CFLAGS as well. Also note that we do store the user-specified CFLAGS in WRAPPER_CFLAGS, so those are not lost either. The attached patch gets rid of MPICH2_EXTRA_CFLAGS and friends; if someone sees a problem with this, please let me know. Rajeev: can you see if this patch solves your problem? -- Pavan On 07/17/2009 09:58 PM, Pavan Balaji wrote:
It looks like it's caused because we add MPI_DEFAULT_COPTS (which contains "-O2") to both MPICH2_EXTRA_CFLAGS and CFLAGS on lines 1649-1654 and then we later temporarily add MPICH2_EXTRA_CFLAGS to CFLAGS for several tests. The right fix is probably to not add MPICH2_DEFAULT_COPTS (and friends) to CFLAGS. However, IIRC this is the mechanism that puts -O2 into the mpicc scripts, so we might have to add another variable to accomplish that still.
We don't add -O2 to mpicc and friends. The optimization flags are only for compiling MPICH2. I'll check what's going on.
-- Pavan
-- Pavan Balaji http://www.mcs.anl.gov/~balaji