[GRASS5] C++ compilation

Glynn Clements glynn.clements at virgin.net
Thu Jan 23 16:43:40 EST 2003

Paul Kelly wrote:

> I fixed a bug (committed to CVS) in src/CMD/generic/gmake.sh where the new
> support for .cc files caused a problem in modules that use lex/yacc: where
> the .c file was not existing at the start of compilation and a .cc extension
> was appended instead of .c (y.tab.c, lex.yy.c).

Yes, the logic was the wrong way around; .c should be the default; .f
or .cc should only be used if the file actually exists.

> I don't think it looks right yet however as $(CC) is used to compile the
> C++ files; probably it should be $(CPP) or something

It should be $(CXX); if $(CPP) is used, it normally refers to the C

Also, it should be using $(CXXFLAGS) rather than $(CFLAGS), but the
rest of the configure mechanism needs to be adjusted accordingly.

Presently, configure.in calls AC_PROG_CC, which sets CFLAGS. Various
bits of configure.in then add things to CFLAGS, which then ends up in
the "head" file via:


In turn, this is referenced in src/CMD/generic/make.mid as:


Basically, configure.in needs to be changed so that most of the stuff
which is currently added to CFLAGS is either kept separate, so that it
can subsequently be added to CXXFLAGS, or is added to both CFLAGS and

> and configure should check for a C++ compiler on the system?

AC_PROG_CXX does this.

Glynn Clements <glynn.clements at virgin.net>

More information about the grass-dev mailing list