autoconf
[Top][All Lists]
Advanced

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

Re: Including sysconfdir in CPPFLAGS


From: Guido Draheim
Subject: Re: Including sysconfdir in CPPFLAGS
Date: Fri, 05 Dec 2003 11:57:44 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030313



Peter Eisentraut wrote:
Fredrik Tolf writes:


How do I get the sysconfdir into a cpp macro if I use automake as
well? Should I do it through a config header, or should I do it via
some automake contraption? Should I just add it to CPPFLAGS? Please
tell me.


The Autoconf manual tells the tale:

   A corollary is that you should not use these variables except in
Makefiles.  For instance, instead of trying to evaluate `datadir' in
`configure' and hardcoding it in Makefiles using e.g.
`AC_DEFINE_UNQUOTED(DATADIR, "$datadir")', you should add
`-DDATADIR="$(datadir)"' to your `CPPFLAGS'.


A corollary to gnu coding standards, and a corollary with little
impact as `make` and `make install` are still two stages. In the
bottom line, it does not matter. - The reality however is even
different: do not use sysconfdir in your program sources! people
are still thinking to put config files in there but that's
inherently wrong. If you want runtime configs, you need to do a
lot of runtime checks and go for ${HOME} first, and some package
specific ${MYPKGCONFIG} second, and only as a fallback go for
a system directory. In that case, do not call it $sysconfdir but
a make/subst MYPCKCONFIG that has a configure.ac fallback to
${sysconfdir}, with the effect that in all build stages the
_specific_ path can be overridden. And that makes for the thing
said above: do not use sysconfdir in your program sources!

cheers,
-- guido                               http://AC-Archive.sf.net
GCS/E/S/P C++/++++$ ULHS L++w- N++@ d(+-) s+a- r+@>+++ y++ 5++X-





reply via email to

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