[geos-devel] Effects of using -g and -O2 together
strk at refractions.net
strk at refractions.net
Thu Jul 6 17:24:21 EDT 2006
On Thu, Jul 06, 2006 at 07:54:53PM +0200, Mateusz Loskot wrote:
> strk at refractions.net wrote:
> > On Thu, Jul 06, 2006 at 07:04:17PM +0200, Mateusz Loskot wrote:
> >
> >> I'd suggest to remove -O2 option if --enable-cassert is passed to
> >> ./configure.
> >>
> >> What do you think?
> >
> > Sounds good to me, we might also rename --enable-cassert to
> > --enable-debug.
>
> Sounds very good to me.
> I'd prefer more consistent behaviour with --enable-debug than
> implicit setting -g with --enable-cassert.
Mm.. I checked and actually, we're not setting -g -O2 explicitly
in any configuration file. Also, we advertise --disable-cassert
to define NDEBUG, which is undefined by default.
So, to summarize, -g -O2 is an implicit setting.
This seems to come from
(info autoconf)
- Macro: AC_PROG_CC ([COMPILER-SEARCH-LIST])
...
If using the GNU C compiler, set shell variable `GCC' to `yes'.
If output variable `CFLAGS' was not already set, set it to `-g
-O2' for the GNU C compiler (`-O2' on systems where GCC does not
accept `-g'), or `-g' for other compilers.
...
- Macro: AC_PROG_CXX ([COMPILER-SEARCH-LIST])
....
If using the GNU C++ compiler, set shell variable `GXX' to `yes'.
If output variable `CXXFLAGS' was not already set, set it to `-g
-O2' for the GNU C++ compiler (`-O2' on systems where G++ does not
accept `-g'), or `-g' for other compilers.
So, GNU seems to disagree with itself
(you can expect this from a recursive acronym)
Anyway, if you export CFLAGS/CXXFLAGS in the environment
those macros shouldn't set anything. I'm not sure it's worth
adding an additional special case for that.
--strk;
More information about the geos-devel
mailing list