[GRASS5] GRASS-header-file locations changed?

Glynn Clements glynn at gclements.plus.com
Wed Feb 15 03:15:17 EST 2006


Markus Neteler wrote:

> > GRASS can't realistically follow normal packaging rules (e.g. 
> > honouring all of the built-in autoconf switches) without using a
> > separate subdirectory (at least four of its headers clash with files
> > already present in my /usr/include directory).
> > 
> > Additionally, the lack of a subdirectory prefix in header names risks
> > causing problems for third-party packages which need to include
> > headers from both GRASS and other packages (how do you ensure that
> > "#include <display.h>" includes GRASS' display.h rather than the one
> > from some other package?).
> 
> 
> *If* things are currently changing, why not renaming files in the
> same moment (sorry for being naive)?
> E.g.,
> 
> #include <grass_display.h>

That's almost exactly what I've done, except that the header is called
<grass/display.h> rather than <grass_display.h>.

Any form of renaming will cause problems for a third party package
using just <display.h>. The advantage of using a directory is that
it's feasible to make both <grass/display.h> and <display.h> work: the
former by using e.g. -I/opt/grass6/include and the latter by using
e.g. -I/opt/grass6/include/grass.

As headers include each other using e.g. <grass/gis.h>, the directory
containing the grass subdirectory always has to be in the include
path, and <grass/gis.h> etc will always work. You can decide whether
or not <gis.h> works by adding or not adding the grass subdirectory
itself to the include path.

To ensure that GRASS' own source code always uses the <grass/gis.h>
form, the grass subdirectory isn't present in the include path during
the GRASS build process.

You can avoid the need for two -I switches by making a symlink, e.g.

	ln -s grass /opt/grass6/include/grass

Thus /opt/grass6/include/grass/grass will be a symlink to
/opt/grass6/include/grass. If you use -I/opt/grass6/include/grass, you
can use either <gis.h> or <grass/gis.h> (or, if you really want,
<grass/grass/grass/grass/gis.h>).

The only real problem I know of so far is that you can't make QGIS use
-I/opt/grass6/include/grass and -L/opt/grass6/lib, because it expects
both the include and lib directories to have exactly the same parent
directory.

Whilst this has been true to date (due to installing everything into
specific subdirectories of $GISBASE), GRASS' build system should
really be honouring the built-in autoconf switches such as --libdir=,
--includedir= etc and installing files wherever the user tells it to
(e.g. native MacOSX packages don't use a "lib" directory, they use
"Libraries").

-- 
Glynn Clements <glynn at gclements.plus.com>




More information about the grass-dev mailing list