[Top][All Lists]

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

Re: How to install "config.h"

From: Gary V. Vaughan
Subject: Re: How to install "config.h"
Date: Fri, 27 Oct 2000 20:44:40 +0100
User-agent: Mutt/1.2.5i

Some food for thought:

On Thu, Oct 26, 2000 at 02:20:10PM -0700, Ossama Othman wrote:
> Hi Alexandre,
> On Thu, Oct 26, 2000 at 07:13:28PM -0200, Alexandre Oliva wrote:
> > If you really want to have it installed, don't call it `config.h', or
> > at least install it in include/<your-package-name>.  To accomplish
> > that, use:
> > 
> > pkginclude_HEADERS = config.h ...
> > 
> > And use `#include <your-package-name/config.h>' in all other headers
> > that include it.
> Ah!  Good call Alexandre!  Robert, please ignore my last post.
> Installing config.h in /usr/local/include, for example, would be
> obviously be bad idea. :-)

Hmmm.  I think that installing config.h is a bad idea under any
circumstances.  I talk about this in some detail in the ``Project''
chapters of the Goat Book (linked from my homepages), and offer an
ugly but functional solution.  Even if you don;'t go for that solution
all out, there is no getting away from the fact that a certain amount
of rewriting is an absolute must.

> BTW, I do exactly what Alexandre suggests in some of my own packages.
> It works out quite nicely.

Well, imagine what will happen when someone wants to use your package
from their own automake project... presumably they will check for
installation with a foo-config or suchlike, and will need to use one
of the headers you installed to prototype api calls their project
requires.  If you needed to install your config.h, that must be
because you need to use it from your other installed header files,
therefor if their project #includes one of those, they are implicitly
including your config.h.  Why is this bad?  For example, you have
`#define PACKAGE "myproject"' which clashes with their `#define
PACKAGE "theirproject".  Lots of other stuff can go horribly wrong too.

Unfortunately, people are being lulled into a false sense of security,
because installing config.h appears to work while it is an uncommon
practice.  Things will go downhill fast if this becomes common
practice -- imagine the chaos that we would have if gtk.h indirectly
#included a raw (i.e. with rewriting prior to installation) config.h,
which set up a whole bunch of HAVE_foo macros and VERSION's that you
don't want to cope with when you use libgtk.  Even worse what if the
gnome headers installed another conig.h with overlapping and
contradicting macros....

  ___              _   ___   __              _         mailto: address@hidden
 / __|__ _ _ ___ _| | / / | / /_ _ _  _ __ _| |_  __ _ ___       address@hidden 
| (_ / _` | '_|// / |/ /| |/ / _` | || / _` | ' \/ _` | _ \
 \___\__,_|_|\_, /|___(_)___/\__,_|\_,_\__, |_||_\__,_|//_/
home page:  /___/                      /___/                  gpg public key: 

reply via email to

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