autoconf
[Top][All Lists]
Advanced

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

Re: Prefix for file in source directory used in ./configure?


From: Ralf Wildenhues
Subject: Re: Prefix for file in source directory used in ./configure?
Date: Sun, 25 Apr 2010 17:54:57 +0200
User-agent: Mutt/1.5.20 (2009-10-28)

* Jason Sewall wrote on Sun, Apr 25, 2010 at 05:21:25PM CEST:
> Russ Allbery writes:
> > > GIT_VERSION=`./GIT-VERSION-GEN`
> >
> > > Obviously, that './' in there doesn't work if I try to configure outside
> > > my source directory. What variable do I need add as prefix to that path
> > > to let builds outside the source tree find that script?
> >
> > If that reference is in a Makefile.am or something similar, you want
> > either $(abs_top_srcdir) or $(top_srcdir).  I tend to use the abs_*
> > versions as a matter of course since they avoid weird issues.
> 
> I've actually got an AH_TEMPLATE, etc associated with that definition above; 
> I'd
> like to have the version end up in config.h.  What is the equivalent of
> $(abs_top_srcdir) in configure.ac?

$ac_top_srcdir, as documented in "info Autoconf 'Configuration Actions'".
Since configure is always run the top build directory, it should suffice
to use $srcdir though.

The advantage of using the absolute versions of the directory names is
that they still work when later used from a different directory, e.g., a
subdirectory of the build tree.  The disadvantage of doing so is that
when a user has source (or build, for the abs*builddir names) tree in a
directory with spaces in the name, she will have problems unless you
consistently quote the result.  The latter, however, is often avoided on
purpose, e.g., so things like commands with arguments can be used.
And of course, names with spaces are unsuitable as makefile targets or
prerequisites, by design of the make program.

configure scripts generated by recent Autoconf versions can otherwise
cope quite well with source directories with spaces in the name.  The
user just has to ensure to provide a relative path to configure, as in
  ../source/configure ...

not an absolute one.

Cheers,
Ralf




reply via email to

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