autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: differences running in build dir or install dir


From: Bob Proulx
Subject: Re: differences running in build dir or install dir
Date: Wed, 14 Nov 2007 10:57:59 -0700
User-agent: Mutt/1.5.13 (2006-08-11)

Bob Rossi wrote:
> This is a sort of general purpose question. It's typical that the
> build directory and the install directly have a different
> directory hierarchy. Therefor, if you run a built program in the 
> build directory versus in the install directory, it would require the
> built program to look for files in different locations.

What files are you referring to and in what context?  Testing?  Other
programs called by the first program?  Configuration or data files
used by the program?

For testing I think setting the PATH in the test environment to
include the build directory so that other programs may be found is
normal.

For data files use the $srcdir and $top_srcdir variables.  The
automake manual (I am assuming that you are using automake) says:

  Programs needing data files should look for them in `srcdir' (which
  is both an environment variable and a make variable) so they work
  when building in a separate directory ...

> My question is, is it typical to encode into the program a bit that
> tells it if it's being run in the build or install directory?

Not for me.  But if you could say a little bit more about the context
of your application it would give more substance to it.

I will usually set things up in the test frame so that all of the
configuration files are specified on the command line using command
line arguments and/or environment variables depending on what I am
testing.  The entire directory can be copied to a different location.
I try to avoid needing hard coded paths.

> Is it typically to say, "Only run the program from the install
> directory?"

That is almost always bad because it makes it impossible to test
without actually installing.  Please save me from that problem.  (I
wanted to say "again".  I have already been hit by it too many times
in the past.)

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]