[GRASS5] Re: GRASS 5.3 with shared libs

Glynn Clements glynn.clements at virgin.net
Wed Jan 7 12:24:04 EST 2004


Paul Kelly wrote:

> The way I checked for the directory configure was being run from was like:
> 
> if test "$BUILD_MECH" = Alternate ; then
>   if test "$SRCDIR" = "$DSTDIR" ; then
>     AC_MSG_ERROR([***  Build directory should not be the same as source \
> directory for the alternate build mechanism. Create a separate build \
> directory and run again, e.g. mkdir grass-build; cd grass-build; ../configure \
> (see mk/README)]);
>   else
>     SC_ENABLE_SHARED
>   fi
> fi
> 
> in configure.in.
> Perhaps there is something wrong with the second line above (not
> portable)?

I suppose that it's possible that $SRCDIR and $DSTDIR could refer to
the same directory without being identical, although this seems
unlikely.

Both SRCDIR and DSTDIR are set from the output from $pwd, which is set
using AC_PATH_PROG, and so should contain the full path to the "pwd"
executable. I can't see how the "pwd" program could return different
strings for the same directory.

OTOH, if AC_PATH_PROG failed (which seems pretty unlikely), $pwd would
default to just "pwd", which may refer to a shell built-in, which can
return different strings for the same directory (e.g. if there are any
symlinks involved).

An alternative approach would be to check for the existence of a known
file. E.g. if $DSTDIR/configure exists, you're probably trying to
build in the source directory.

> In general I thought with the alternate build system it must be run from a
> separate build directory.

AFAIK, it will work if run from within the source directory. However,
it doesn't have a working "clean" target; it doesn't need one: you can
just run "rm -rf" on the build directory. But you certainly don't want
to do that if $SRCDIR == $DSTDIR.

> That was also why I copied the error.log file
> back to the top level source directory as the POST_INSTALL.sh script
> looked for it there. Again, the contents of POST_INSTALL.sh could be
> duplicated in mk/Makefile.in but I didn't want to change more things than
> I had to to make it work.

Alternatively, pass $DSTDIR to POST_INSTALL.sh and have it look for
$DSTDIR/error.log.

I removed the copying of error.log because the alternate build
mechanism isn't supposed to require write access to the source
directory (e.g. to allow building from a source tree which resides on
a read-only NFS export).

> Perhaps it would be nice if the alternate build system could create its
> own build directory automatically if it detects it is being run from the
> top-level of the source. I thought about this but decided that was being
> too clever.

That's my feeling too. That would require configure to choose a build
directory. The directory would definitely have to be writable, and
ideally would have to be on a filesystem with sufficient free space,
and it probably shouldn't choose the directory which you used last
time in case you still wanted to keep that build around (another
reason for the alternate build system was to support keeping multiple
builds around for the same architecture).

> It is worth tidying it up though but I was under the impression that with
> the alternate build system we really should use a separate build
> directory (and that is how I tested it).

That was the idea.

-- 
Glynn Clements <glynn.clements at virgin.net>




More information about the grass-dev mailing list