Autor: Bob Rossi Datum: To: pcre-dev CC: Robert Roessler Betreff: Re: [pcre-dev] Thoughts about build systems
On Sat, Sep 01, 2007 at 09:05:20PM +0100, Philip Hazel wrote: > > #2 is strictly a technical issue. If you use "", and you're doing an
> > out-of-source-tree build, and the source tree has a config.h file, then
> > your build will incorrectly use the source tree's config.h instead of
> > your own (because "" first looks in the same directory as the source
> > file being compiled, even if your -I directives specify otherwise).
> >
> > It is unfortunate that <> gives the impression that config.h is some
> > kind of system/installed header file. But I argue that this bit of
> > semantic weirdness is the lesser evil, compared to doing the absolute
> > wrong thing in the above scenario. And that, I believe, is what is
> > behind the same recommendation in the Autoconf manual.
>
> A look at my (admittedly ancient) C standard doesn't help. It
> essentially says that both <> and "" semantics are implementation
> defined. I myself was previously caught with <> for pcre.h picking up a
> system-installed header rather than the local one - but that was when
> compiling Exim with included PCRE files. There is no -I. there.
>
> Now, we don't distribute config.h - just config.h.generic - so the
> danger Daniel describes will happen only if somebody configures within
> the source directory, and then re-configures and tries to build outside
> the source directory. How likely is that?
>
> I can't please everyone here, that is clear. There will be gotchas
> either way. Which of these two is more likely?
>
> (a) Somebody using the autotools configures inside the source directory,
> then reconfigures (differently) and builds outside the source directory
> (without having done a "make distclean" in the source directory). With
> "", they get the config.h from the source directory.
Don't worry about the above case. AFAIK, you shouldn't configure both in
and out of the source tree. If you do, it's perfectly fine to ask the
user to blast the source directory, and start from scratch. BTW, you get
this error message from the autotools when you go to configure out of a
tree that you already configured in:
bob@black ~/rcs/svn/cgdb/cgdb-tests/build
$ ../cgdb/configure --prefix=$PWD/../prefix/second
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
configure: error: source directory already configured; run "make distclean" there first
> (b) Somebody not using the autotools does not use -I. on the compiler.
> (I discount the possibility that there is a compiler without the -I.
> option.) With <>, if there is a file called config.h somewhere in the
> standard include directories, they get that. If not, they get a "not
> found" error.
>
> My view is that (a) is likely to be rarer than (b), but that there may
> well be more people using the autotools than not. So how can I balance
> that up and make a choice?
Again, don't even consider (a) a case. You can just worry about the (b)
use case.
> I think I should change <> back to "". For two reasons: not only the
> above, but it also makes it clear when reading the source that it really
> is a local header file - that's always been my interpretation of <> vs
> "" and I suspect many people think the same.
>
> In other words, I disagree with Daniel on this point.
>
> I wasn't planning on a 7.4 soon ... but maybe there will have to be one.
> See also my next message.