autoconf
[Top][All Lists]
Advanced

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

Re: How to retrieve an absolute path in this case?


From: Eric Blake
Subject: Re: How to retrieve an absolute path in this case?
Date: Fri, 26 Mar 2010 08:38:42 -0600
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b1 Thunderbird/3.0.3

On 03/25/2010 11:47 AM, ant1scene wrote:
> Hello. 
> 
> I need lookup config's path in application. 
> Tried as is: 
> 
> --configure.in (fragment)
> AC_DEFINE_UNQUOTED(PREFIX, $prefix, [Install prefix])
> AC_DEFINE_UNQUOTED(SERVER_CONFIG_FILE, "${sysconfdir}/foo.conf",
>       [Location of the config file])
> --
> but, after running 'configure' I'm getting such config.h:
> #define SERVER_CONFIG_FILE "${prefix}/etc/foo.conf"
> #define PREFIX /usr
> 
> what to do to retrieve ${prefix} in SERVER_CONFIG_FILE?

Here's what the manuals have to say about it:
http://www.gnu.org/software/autoconf/manual/autoconf.html#Installation-Directory-Variables

Here's how gnulib does it:
http://git.savannah.gnu.org/cgit/gnulib.git/tree/modules/configmake

In short, _don't_ use AC_DEFINE_UNQUOTED.  Doing it a configure time is
too early, and does not have enough levels of expansion.  Instead, use
AC_SUBST, and modify your Makefile.{am,in} (depending on whether you use
automake) to do the substitution at make time.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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